@@ -35,16 +35,16 @@ |
||
35 | 35 | */ |
36 | 36 | public function getSnapshots(): PaginableArray |
37 | 37 | { |
38 | - $order = []; |
|
39 | - $snapshots = []; |
|
38 | + $order = [ ]; |
|
39 | + $snapshots = [ ]; |
|
40 | 40 | |
41 | 41 | if (!$this->files->exists($this->config->reportingDirectory())) { |
42 | 42 | return new PaginableArray(); |
43 | 43 | } |
44 | 44 | |
45 | 45 | foreach ($this->files->getFiles($this->config->reportingDirectory(), '*.html') as $file) { |
46 | - $snapshots[] = new FileSnapshot($file); |
|
47 | - $order[] = $this->files->time($file); |
|
46 | + $snapshots[ ] = new FileSnapshot($file); |
|
47 | + $order[ ] = $this->files->time($file); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | array_multisort($order, SORT_DESC, $snapshots); |
@@ -24,9 +24,9 @@ |
||
24 | 24 | <vault:uri target="snapshots:suppressIncident" |
25 | 25 | class="btn blue-grey darken-2 waves-effect waves-light" icon="archive" |
26 | 26 | options="<?= [ |
27 | - 'id' => $snapshot->primaryKey(), |
|
28 | - 'incident' => $incident->primaryKey() |
|
29 | - ] ?>"> |
|
27 | + 'id' => $snapshot->primaryKey(), |
|
28 | + 'incident' => $incident->primaryKey() |
|
29 | + ] ?>"> |
|
30 | 30 | [[Suppress]] |
31 | 31 | </vault:uri> |
32 | 32 | <?php } ?> |
@@ -32,7 +32,7 @@ |
||
32 | 32 | <?php } ?> |
33 | 33 | |
34 | 34 | <vault:uri target="snapshots:view" class="btn-flat waves-effect" |
35 | - post-icon="trending_flat" options="<?= ['id' => $snapshot->primaryKey()] ?>"> |
|
35 | + post-icon="trending_flat" options="<?= [ 'id' => $snapshot->primaryKey() ] ?>"> |
|
36 | 36 | [[BACK]] |
37 | 37 | </vault:uri> |
38 | 38 | </vault:guard> |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | return [ |
158 | 158 | 'status' => 200, |
159 | 159 | 'message' => $this->say('Snapshots deleted.'), |
160 | - 'action' => ['redirect' => $uri] |
|
160 | + 'action' => [ 'redirect' => $uri ] |
|
161 | 161 | ]; |
162 | 162 | } else { |
163 | 163 | return $this->response->redirect($uri); |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | return [ |
194 | 194 | 'status' => 200, |
195 | 195 | 'message' => $this->say('Snapshot deleted.'), |
196 | - 'action' => ['redirect' => $uri] |
|
196 | + 'action' => [ 'redirect' => $uri ] |
|
197 | 197 | ]; |
198 | 198 | } else { |
199 | 199 | return $this->response->redirect($uri); |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | if (array_key_exists('backToList', $query)) { |
213 | 213 | $uri = $this->vault->uri('snapshots'); |
214 | 214 | } else { |
215 | - $uri = $request->getServerParams()['HTTP_REFERER']; |
|
215 | + $uri = $request->getServerParams()[ 'HTTP_REFERER' ]; |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | return $uri; |
@@ -252,14 +252,14 @@ discard block |
||
252 | 252 | $incident->save(); |
253 | 253 | |
254 | 254 | $uri = $this->vault |
255 | - ->uri('snapshots:view', ['id' => $snapshot->primaryKey()]) |
|
255 | + ->uri('snapshots:view', [ 'id' => $snapshot->primaryKey() ]) |
|
256 | 256 | ->withFragment('history'); |
257 | 257 | |
258 | 258 | if ($this->input->isAjax()) { |
259 | 259 | return [ |
260 | 260 | 'status' => 200, |
261 | 261 | 'message' => $this->say('Snapshot incident suppressed.'), |
262 | - 'action' => ['redirect' => $uri] |
|
262 | + 'action' => [ 'redirect' => $uri ] |
|
263 | 263 | ]; |
264 | 264 | } else { |
265 | 265 | return $this->response->redirect($uri); |
@@ -368,14 +368,14 @@ discard block |
||
368 | 368 | $incident->delete(); |
369 | 369 | |
370 | 370 | $uri = $this->vault |
371 | - ->uri('snapshots:view', ['id' => $snapshot->primaryKey()]) |
|
371 | + ->uri('snapshots:view', [ 'id' => $snapshot->primaryKey() ]) |
|
372 | 372 | ->withFragment('history'); |
373 | 373 | |
374 | 374 | if ($this->input->isAjax()) { |
375 | 375 | return [ |
376 | 376 | 'status' => 200, |
377 | 377 | 'message' => $this->say('Snapshot incident deleted.'), |
378 | - 'action' => ['redirect' => $uri] |
|
378 | + 'action' => [ 'redirect' => $uri ] |
|
379 | 379 | ]; |
380 | 380 | } else { |
381 | 381 | return $this->response->redirect($uri); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | <div class="col s12 m2 right-align"> |
33 | 33 | <vault:guard permission="vault.snapshots.view"> |
34 | 34 | <vault:uri target="snapshots:view" icon="import_contacts" class="btn waves-effect waves-light" |
35 | - options="<?= ['id' => $lastSnapshot->primaryKey()] ?>"> |
|
35 | + options="<?= [ 'id' => $lastSnapshot->primaryKey() ] ?>"> |
|
36 | 36 | [[View last]] |
37 | 37 | </vault:uri> |
38 | 38 | </vault:guard> |
@@ -91,12 +91,12 @@ discard block |
||
91 | 91 | |
92 | 92 | <grid:cell style="text-align:right"> |
93 | 93 | <vault:guard permission="vault.snapshots.view"> |
94 | - <vault:uri target="snapshots:view" icon="import_contacts" title="[[View snapshot]]" options="<?= ['id' => $entity->primaryKey()] ?>" |
|
94 | + <vault:uri target="snapshots:view" icon="import_contacts" title="[[View snapshot]]" options="<?= [ 'id' => $entity->primaryKey() ] ?>" |
|
95 | 95 | class="btn waves-effect"/> |
96 | 96 | </vault:guard> |
97 | 97 | <vault:guard permission="vault.snapshots.remove"> |
98 | 98 | <vault:uri target="snapshots:remove" icon="delete" title="[[Remove snapshot]]" class="btn red waves-effect waves-light" |
99 | - options="<?= ['id' => $entity->primaryKey()] ?>"/> |
|
99 | + options="<?= [ 'id' => $entity->primaryKey() ] ?>"/> |
|
100 | 100 | </vault:guard> |
101 | 101 | </grid:cell> |
102 | 102 | </vault:grid> |
@@ -42,13 +42,13 @@ |
||
42 | 42 | <grid:cell style="text-align:right"> |
43 | 43 | <vault:guard permission="vault.snapshots.view"> |
44 | 44 | <vault:uri target="snapshots:view" icon="import_contacts" title="[[View snapshot]]" |
45 | - options="<?= ['filename' => $entity->id()] ?>" |
|
45 | + options="<?= [ 'filename' => $entity->id() ] ?>" |
|
46 | 46 | class="btn waves-effect"/> |
47 | 47 | </vault:guard> |
48 | 48 | <vault:guard permission="vault.snapshots.remove"> |
49 | 49 | <vault:uri target="snapshots:remove" icon="delete" title="[[Remove snapshot]]" |
50 | 50 | class="btn red waves-effect waves-light" |
51 | - options="<?= ['filename' => $entity->id()] ?>"/> |
|
51 | + options="<?= [ 'filename' => $entity->id() ] ?>"/> |
|
52 | 52 | </vault:guard> |
53 | 53 | </grid:cell> |
54 | 54 | </vault:grid> |
@@ -64,8 +64,8 @@ |
||
64 | 64 | * {@inheritdoc} |
65 | 65 | */ |
66 | 66 | const INDEXES = [ |
67 | - [self::INDEX, 'exception_hash'], |
|
68 | - [self::INDEX, 'exception_hash', 'status'], |
|
67 | + [ self::INDEX, 'exception_hash' ], |
|
68 | + [ self::INDEX, 'exception_hash', 'status' ], |
|
69 | 69 | ]; |
70 | 70 | |
71 | 71 | /** |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | { |
94 | 94 | use LoggerTrait; |
95 | 95 | |
96 | - public function log($level, $message, array $context = []) |
|
96 | + public function log($level, $message, array $context = [ ]) |
|
97 | 97 | { |
98 | 98 | if ($level == LogLevel::ERROR) { |
99 | 99 | echo " \n! \033[31m" . $message . "\033[0m"; |
@@ -172,8 +172,8 @@ discard block |
||
172 | 172 | } |
173 | 173 | |
174 | 174 | return $this->orm->source(SnapshotRecord::class)->findOne( |
175 | - [], |
|
176 | - ['id' => SelectQuery::SORT_DESC] |
|
175 | + [ ], |
|
176 | + [ 'id' => SelectQuery::SORT_DESC ] |
|
177 | 177 | ); |
178 | 178 | } |
179 | 179 | |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | */ |
184 | 184 | protected function handleFileSnapshot(Snapshot $snapshot, bool $report = true) |
185 | 185 | { |
186 | - $this->app->getBootloader()->bootload([FileHandlerBootloader::class]); |
|
186 | + $this->app->getBootloader()->bootload([ FileHandlerBootloader::class ]); |
|
187 | 187 | |
188 | 188 | /** @var DelegateSnapshot $delegate */ |
189 | 189 | $delegate = $this->factory->make(DelegateSnapshot::class, [ |
@@ -11,7 +11,7 @@ |
||
11 | 11 | { |
12 | 12 | public function testFileRender() |
13 | 13 | { |
14 | - $this->app->getBootloader()->bootload([FileHandlerBootloader::class]); |
|
14 | + $this->app->getBootloader()->bootload([ FileHandlerBootloader::class ]); |
|
15 | 15 | |
16 | 16 | $snapshot = $this->makeSnapshot('File error', 123); |
17 | 17 | /** @var DelegateSnapshot $delegate */ |
@@ -62,18 +62,18 @@ discard block |
||
62 | 62 | $snapshotRecord = $this->handleSnapshot($snapshot, true); |
63 | 63 | $counters = $service->countOccurred($snapshotRecord, $source); |
64 | 64 | |
65 | - $this->assertEquals(1, $counters['daily']); |
|
66 | - $this->assertEquals(1, $counters['weekly']); |
|
67 | - $this->assertEquals(1, $counters['monthly']); |
|
68 | - $this->assertEquals(1, $counters['yearly']); |
|
65 | + $this->assertEquals(1, $counters[ 'daily' ]); |
|
66 | + $this->assertEquals(1, $counters[ 'weekly' ]); |
|
67 | + $this->assertEquals(1, $counters[ 'monthly' ]); |
|
68 | + $this->assertEquals(1, $counters[ 'yearly' ]); |
|
69 | 69 | |
70 | 70 | $this->handleSnapshot($snapshot, true); |
71 | 71 | $counters = $service->countOccurred($snapshotRecord, $source); |
72 | 72 | |
73 | - $this->assertEquals(2, $counters['daily']); |
|
74 | - $this->assertEquals(2, $counters['weekly']); |
|
75 | - $this->assertEquals(2, $counters['monthly']); |
|
76 | - $this->assertEquals(2, $counters['yearly']); |
|
73 | + $this->assertEquals(2, $counters[ 'daily' ]); |
|
74 | + $this->assertEquals(2, $counters[ 'weekly' ]); |
|
75 | + $this->assertEquals(2, $counters[ 'monthly' ]); |
|
76 | + $this->assertEquals(2, $counters[ 'yearly' ]); |
|
77 | 77 | |
78 | 78 | /** @var IncidentRecord $incident */ |
79 | 79 | $incident = $snapshotRecord->getIncidentsHistory()->getIterator()->current(); |
@@ -83,40 +83,40 @@ discard block |
||
83 | 83 | $incident->save(); |
84 | 84 | |
85 | 85 | $counters = $service->countOccurred($snapshotRecord, $source); |
86 | - $this->assertEquals(1, $counters['daily']); |
|
87 | - $this->assertEquals(2, $counters['weekly']); |
|
88 | - $this->assertEquals(2, $counters['monthly']); |
|
89 | - $this->assertEquals(2, $counters['yearly']); |
|
86 | + $this->assertEquals(1, $counters[ 'daily' ]); |
|
87 | + $this->assertEquals(2, $counters[ 'weekly' ]); |
|
88 | + $this->assertEquals(2, $counters[ 'monthly' ]); |
|
89 | + $this->assertEquals(2, $counters[ 'yearly' ]); |
|
90 | 90 | |
91 | 91 | //One of them occurred not in this week |
92 | 92 | $incident->time_created = (new \DateTime('now'))->sub(new \DateInterval('P8D')); |
93 | 93 | $incident->save(); |
94 | 94 | |
95 | 95 | $counters = $service->countOccurred($snapshotRecord, $source); |
96 | - $this->assertEquals(1, $counters['daily']); |
|
97 | - $this->assertEquals(1, $counters['weekly']); |
|
98 | - $this->assertEquals(2, $counters['monthly']); |
|
99 | - $this->assertEquals(2, $counters['yearly']); |
|
96 | + $this->assertEquals(1, $counters[ 'daily' ]); |
|
97 | + $this->assertEquals(1, $counters[ 'weekly' ]); |
|
98 | + $this->assertEquals(2, $counters[ 'monthly' ]); |
|
99 | + $this->assertEquals(2, $counters[ 'yearly' ]); |
|
100 | 100 | |
101 | 101 | //One of them occurred not in this month |
102 | 102 | $incident->time_created = (new \DateTime('now'))->sub(new \DateInterval('P2M')); |
103 | 103 | $incident->save(); |
104 | 104 | |
105 | 105 | $counters = $service->countOccurred($snapshotRecord, $source); |
106 | - $this->assertEquals(1, $counters['daily']); |
|
107 | - $this->assertEquals(1, $counters['weekly']); |
|
108 | - $this->assertEquals(1, $counters['monthly']); |
|
109 | - $this->assertEquals(2, $counters['yearly']); |
|
106 | + $this->assertEquals(1, $counters[ 'daily' ]); |
|
107 | + $this->assertEquals(1, $counters[ 'weekly' ]); |
|
108 | + $this->assertEquals(1, $counters[ 'monthly' ]); |
|
109 | + $this->assertEquals(2, $counters[ 'yearly' ]); |
|
110 | 110 | |
111 | 111 | //One of them occurred not in this year |
112 | 112 | $incident->time_created = (new \DateTime('now'))->sub(new \DateInterval('P2Y')); |
113 | 113 | $incident->save(); |
114 | 114 | |
115 | 115 | $counters = $service->countOccurred($snapshotRecord, $source); |
116 | - $this->assertEquals(1, $counters['daily']); |
|
117 | - $this->assertEquals(1, $counters['weekly']); |
|
118 | - $this->assertEquals(1, $counters['monthly']); |
|
119 | - $this->assertEquals(1, $counters['yearly']); |
|
116 | + $this->assertEquals(1, $counters[ 'daily' ]); |
|
117 | + $this->assertEquals(1, $counters[ 'weekly' ]); |
|
118 | + $this->assertEquals(1, $counters[ 'monthly' ]); |
|
119 | + $this->assertEquals(1, $counters[ 'yearly' ]); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | $this->assertNotEmpty($snapshotRecord->getLastIncident()); |
140 | 140 | $this->assertCount(0, $snapshotRecord->getIncidentsHistory()); |
141 | 141 | $this->assertCount(1, $incidentSource); |
142 | - $this->assertCount(1, $incidentSource->find(['status' => IncidentStatus::LAST])); |
|
142 | + $this->assertCount(1, $incidentSource->find([ 'status' => IncidentStatus::LAST ])); |
|
143 | 143 | |
144 | 144 | $service->delete($snapshotRecord); |
145 | 145 | |
@@ -151,10 +151,10 @@ discard block |
||
151 | 151 | // $this->assertEmpty($snapshotRecord->getLastIncident()); |
152 | 152 | $this->assertCount(1, $snapshotRecord->getIncidentsHistory()); |
153 | 153 | $this->assertCount(1, $incidentSource); |
154 | - $this->assertCount(1, $incidentSource->find(['status' => IncidentStatus::DELETED])); |
|
154 | + $this->assertCount(1, $incidentSource->find([ 'status' => IncidentStatus::DELETED ])); |
|
155 | 155 | |
156 | 156 | /** @var IncidentRecord $incident */ |
157 | - $incident = iterator_to_array($snapshotRecord->getIncidentsHistory())[0]; |
|
157 | + $incident = iterator_to_array($snapshotRecord->getIncidentsHistory())[ 0 ]; |
|
158 | 158 | |
159 | 159 | $this->assertNotEmpty($incident); |
160 | 160 | $this->assertEmpty($incident->getExceptionSource()); |