Skip to content

Commit af91721

Browse files
committed
Fixed #3, Clean Code
1 parent 1895c2a commit af91721

2 files changed

Lines changed: 1 addition & 8 deletions

File tree

demo/app/Drivers/FileLog.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Dframe\ActivityLog\Demo\Drivers;
44

5-
65
define('APP_DIR', __DIR__ . '/../');
76

87
/**
@@ -17,7 +16,6 @@ class FileLog implements \Dframe\ActivityLog\Driver
1716

1817
public function push($loggedId, $on, $entity, $log)
1918
{
20-
2119
$data = [];
2220
$data['loggedId'] = '1';
2321
$data['on'] = $on;
@@ -30,7 +28,6 @@ public function push($loggedId, $on, $entity, $log)
3028
}
3129

3230
if (filesize(self::FILE_DB) > 0) {
33-
3431
$contents = null;
3532
while (!feof($fp)) {
3633
$contents .= fread($fp, 8192);
@@ -44,11 +41,8 @@ public function push($loggedId, $on, $entity, $log)
4441

4542
$fp = fopen(self::FILE_DB, 'w+');
4643
$result = fwrite($fp, json_encode($jsondecode));
47-
4844
} else {
49-
5045
$result = fwrite($fp, json_encode($data));
51-
5246
}
5347

5448
flock($fp, LOCK_UN);
@@ -85,5 +79,4 @@ public function logs($start, $limit, $where, $order, $sort)
8579
$data = json_decode($contents, true);
8680
return ['return' => true, 'data' => $data];
8781
}
88-
8982
}

demo/web/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
$log->log('system')->entity(\Dframe\ActivityLog\Demo\Entity\Action::class, ['Hello Word!'])->push();
1616

1717
echo '<pre>';
18-
var_dump($log->logs(null, null, null, null, null));
18+
var_dump($log->logs(null, null, null, null, null));

0 commit comments

Comments
 (0)