@@ -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:edit', ['id' => $snapshot->primaryKey()]) |
|
| 255 | + ->uri('snapshots:edit', [ '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:edit', ['id' => $snapshot->primaryKey()]) |
|
| 371 | + ->uri('snapshots:edit', [ '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); |
@@ -34,16 +34,16 @@ |
||
| 34 | 34 | */ |
| 35 | 35 | public function getSnapshots() |
| 36 | 36 | { |
| 37 | - $order = []; |
|
| 38 | - $snapshots = []; |
|
| 37 | + $order = [ ]; |
|
| 38 | + $snapshots = [ ]; |
|
| 39 | 39 | |
| 40 | 40 | if (!$this->files->exists($this->config->reportingDirectory())) { |
| 41 | - return []; |
|
| 41 | + return [ ]; |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | foreach ($this->files->getFiles($this->config->reportingDirectory(), '*.html') as $file) { |
| 45 | - $snapshots[] = new FileSnapshot($file); |
|
| 46 | - $order[] = $this->files->time($file); |
|
| 45 | + $snapshots[ ] = new FileSnapshot($file); |
|
| 46 | + $order[ ] = $this->files->time($file); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | array_multisort($order, SORT_DESC, $snapshots); |
@@ -38,6 +38,6 @@ |
||
| 38 | 38 | */ |
| 39 | 39 | public function timestamp(): FileTimestamp |
| 40 | 40 | { |
| 41 | - return new FileTimestamp(filemtime($this->filename), []); |
|
| 41 | + return new FileTimestamp(filemtime($this->filename), [ ]); |
|
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | \ No newline at end of file |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | return [ |
| 104 | 104 | 'status' => 200, |
| 105 | 105 | 'message' => $this->say('Snapshots deleted.'), |
| 106 | - 'action' => ['redirect' => $uri] |
|
| 106 | + 'action' => [ 'redirect' => $uri ] |
|
| 107 | 107 | ]; |
| 108 | 108 | } else { |
| 109 | 109 | return $this->response->redirect($uri); |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | return [ |
| 137 | 137 | 'status' => 200, |
| 138 | 138 | 'message' => $this->say('Snapshot deleted.'), |
| 139 | - 'action' => ['redirect' => $uri] |
|
| 139 | + 'action' => [ 'redirect' => $uri ] |
|
| 140 | 140 | ]; |
| 141 | 141 | } else { |
| 142 | 142 | return $this->response->redirect($uri); |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | if (array_key_exists('backToList', $query)) { |
| 156 | 156 | $uri = $this->vault->uri('snapshots'); |
| 157 | 157 | } else { |
| 158 | - $uri = $request->getServerParams()['HTTP_REFERER']; |
|
| 158 | + $uri = $request->getServerParams()[ 'HTTP_REFERER' ]; |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | return $uri; |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | { |
| 95 | 95 | use LoggerTrait; |
| 96 | 96 | |
| 97 | - public function log($level, $message, array $context = []) |
|
| 97 | + public function log($level, $message, array $context = [ ]) |
|
| 98 | 98 | { |
| 99 | 99 | if ($level == LogLevel::ERROR) { |
| 100 | 100 | echo " \n! \033[31m" . $message . "\033[0m"; |
@@ -173,8 +173,8 @@ discard block |
||
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | return $this->orm->source(SnapshotRecord::class)->findOne( |
| 176 | - [], |
|
| 177 | - ['id' => SelectQuery::SORT_DESC] |
|
| 176 | + [ ], |
|
| 177 | + [ 'id' => SelectQuery::SORT_DESC ] |
|
| 178 | 178 | ); |
| 179 | 179 | } |
| 180 | 180 | |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | */ |
| 185 | 185 | protected function handleFileSnapshot(Snapshot $snapshot, bool $report = true) |
| 186 | 186 | { |
| 187 | - $this->app->getBootloader()->bootload([FileSnapshotterBootloader::class]); |
|
| 187 | + $this->app->getBootloader()->bootload([ FileSnapshotterBootloader::class ]); |
|
| 188 | 188 | |
| 189 | 189 | /** @var DelegateSnapshot $delegate */ |
| 190 | 190 | $delegate = $this->factory->make(DelegateSnapshot::class, [ |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | */ |
| 36 | 36 | class TestApplication extends Core |
| 37 | 37 | { |
| 38 | - const LOAD = [SpiralBindings::class]; |
|
| 38 | + const LOAD = [ SpiralBindings::class ]; |
|
| 39 | 39 | |
| 40 | 40 | protected function bootstrap() |
| 41 | 41 | { |
@@ -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()); |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | $this->assertCount(1, $record->getIncidentsHistory()); |
| 33 | 33 | |
| 34 | 34 | /** @var IncidentRecord $incident */ |
| 35 | - $incident = iterator_to_array($record->getIncidentsHistory())[0]; |
|
| 35 | + $incident = iterator_to_array($record->getIncidentsHistory())[ 0 ]; |
|
| 36 | 36 | |
| 37 | 37 | $this->assertNotEmpty($incident); |
| 38 | 38 | $this->assertNotEmpty($incident->getExceptionSource()); |
@@ -47,13 +47,13 @@ discard block |
||
| 47 | 47 | $this->assertEquals(3, $record->count_occurred); |
| 48 | 48 | $this->assertCount(2, $record->getIncidentsHistory()); |
| 49 | 49 | |
| 50 | - $incident = iterator_to_array($record->getIncidentsHistory())[0]; |
|
| 50 | + $incident = iterator_to_array($record->getIncidentsHistory())[ 0 ]; |
|
| 51 | 51 | |
| 52 | 52 | $this->assertNotEmpty($incident); |
| 53 | 53 | $this->assertNotEmpty($incident->getExceptionSource()); |
| 54 | 54 | $this->assertTrue($incident->status->isStored()); |
| 55 | 55 | |
| 56 | - $incident = iterator_to_array($record->getIncidentsHistory())[1]; |
|
| 56 | + $incident = iterator_to_array($record->getIncidentsHistory())[ 1 ]; |
|
| 57 | 57 | |
| 58 | 58 | $this->assertNotEmpty($incident); |
| 59 | 59 | $this->assertEmpty($incident->getExceptionSource()); |
@@ -69,20 +69,20 @@ discard block |
||
| 69 | 69 | $this->assertEquals(4, $record->count_occurred); |
| 70 | 70 | $this->assertCount(3, $record->getIncidentsHistory()); |
| 71 | 71 | |
| 72 | - $incident = iterator_to_array($record->getIncidentsHistory())[0]; |
|
| 72 | + $incident = iterator_to_array($record->getIncidentsHistory())[ 0 ]; |
|
| 73 | 73 | |
| 74 | 74 | $this->assertNotEmpty($incident); |
| 75 | 75 | $this->assertNotEmpty($incident->getExceptionSource()); |
| 76 | 76 | $this->assertTrue($incident->status->isStored()); |
| 77 | 77 | |
| 78 | - $incident = iterator_to_array($record->getIncidentsHistory())[1]; |
|
| 78 | + $incident = iterator_to_array($record->getIncidentsHistory())[ 1 ]; |
|
| 79 | 79 | |
| 80 | 80 | $this->assertNotEmpty($incident); |
| 81 | 81 | $this->assertEmpty($incident->getExceptionSource()); |
| 82 | 82 | $this->assertFalse($incident->status->isStored()); |
| 83 | 83 | $this->assertTrue($incident->status->isSuppressed()); |
| 84 | 84 | |
| 85 | - $incident = iterator_to_array($record->getIncidentsHistory())[2]; |
|
| 85 | + $incident = iterator_to_array($record->getIncidentsHistory())[ 2 ]; |
|
| 86 | 86 | |
| 87 | 87 | $this->assertNotEmpty($incident); |
| 88 | 88 | $this->assertNotEmpty($incident->getExceptionSource()); |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | $service = $this->container->get(SnapshotService::class); |
| 35 | 35 | |
| 36 | 36 | /** @var FileSnapshot $file */ |
| 37 | - $file = $service->getSnapshots()[0]; |
|
| 37 | + $file = $service->getSnapshots()[ 0 ]; |
|
| 38 | 38 | $this->assertInstanceOf(FileSnapshot::class, $file); |
| 39 | 39 | $filename = $file->id(); |
| 40 | 40 | |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | $service = $this->container->get(SnapshotService::class); |
| 52 | 52 | |
| 53 | 53 | /** @var FileSnapshot $file */ |
| 54 | - $file = $service->getSnapshots()[0]; |
|
| 54 | + $file = $service->getSnapshots()[ 0 ]; |
|
| 55 | 55 | |
| 56 | 56 | $this->assertNotEmpty($service->read($file)); |
| 57 | 57 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | $service = $this->container->get(SnapshotService::class); |
| 66 | 66 | |
| 67 | 67 | /** @var FileSnapshot $file */ |
| 68 | - $file = $service->getSnapshots()[0]; |
|
| 68 | + $file = $service->getSnapshots()[ 0 ]; |
|
| 69 | 69 | |
| 70 | 70 | $this->assertTrue($service->exists($file->id())); |
| 71 | 71 | $this->assertFalse($service->exists('some name')); |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | $service = $this->container->get(SnapshotService::class); |
| 81 | 81 | |
| 82 | 82 | /** @var FileSnapshot $file */ |
| 83 | - $file = $service->getSnapshots()[0]; |
|
| 83 | + $file = $service->getSnapshots()[ 0 ]; |
|
| 84 | 84 | |
| 85 | 85 | $this->assertTrue($service->exists($file->id())); |
| 86 | 86 | |