@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | HandlerInterface $handler, |
| 54 | 54 | FilesInterface $files, |
| 55 | 55 | LoggerInterface $logger = null |
| 56 | - ) { |
|
| 56 | + ){ |
|
| 57 | 57 | $this->directory = $directory; |
| 58 | 58 | $this->maxFiles = $maxFiles; |
| 59 | 59 | $this->verbosity = $verbosity; |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | { |
| 70 | 70 | $snapshot = new Snapshot($this->getID($e), $e); |
| 71 | 71 | |
| 72 | - if ($this->logger !== null) { |
|
| 72 | + if ($this->logger !== null){ |
|
| 73 | 73 | $this->logger->error($snapshot->getMessage()); |
| 74 | 74 | } |
| 75 | 75 | |
@@ -102,18 +102,18 @@ discard block |
||
| 102 | 102 | { |
| 103 | 103 | $finder = new Finder(); |
| 104 | 104 | $finder->in($this->directory)->sort( |
| 105 | - static function (SplFileInfo $a, SplFileInfo $b) { |
|
| 105 | + static function (SplFileInfo $a, SplFileInfo $b){ |
|
| 106 | 106 | return $b->getMTime() - $a->getMTime(); |
| 107 | 107 | } |
| 108 | 108 | ); |
| 109 | 109 | |
| 110 | 110 | $count = 0; |
| 111 | - foreach ($finder as $file) { |
|
| 111 | + foreach ($finder as $file){ |
|
| 112 | 112 | $count++; |
| 113 | - if ($count > $this->maxFiles) { |
|
| 114 | - try { |
|
| 113 | + if ($count > $this->maxFiles){ |
|
| 114 | + try{ |
|
| 115 | 115 | $this->files->delete($file->getRealPath()); |
| 116 | - } catch (FilesException $e) { |
|
| 116 | + }catch (FilesException $e){ |
|
| 117 | 117 | // ignore |
| 118 | 118 | } |
| 119 | 119 | } |
@@ -69,7 +69,8 @@ discard block |
||
| 69 | 69 | { |
| 70 | 70 | $snapshot = new Snapshot($this->getID($e), $e); |
| 71 | 71 | |
| 72 | - if ($this->logger !== null) { |
|
| 72 | + if ($this->logger !== null) |
|
| 73 | + { |
|
| 73 | 74 | $this->logger->error($snapshot->getMessage()); |
| 74 | 75 | } |
| 75 | 76 | |
@@ -102,18 +103,24 @@ discard block |
||
| 102 | 103 | { |
| 103 | 104 | $finder = new Finder(); |
| 104 | 105 | $finder->in($this->directory)->sort( |
| 105 | - static function (SplFileInfo $a, SplFileInfo $b) { |
|
| 106 | + static function (SplFileInfo $a, SplFileInfo $b) |
|
| 107 | + { |
|
| 106 | 108 | return $b->getMTime() - $a->getMTime(); |
| 107 | 109 | } |
| 108 | 110 | ); |
| 109 | 111 | |
| 110 | 112 | $count = 0; |
| 111 | - foreach ($finder as $file) { |
|
| 113 | + foreach ($finder as $file) |
|
| 114 | + { |
|
| 112 | 115 | $count++; |
| 113 | - if ($count > $this->maxFiles) { |
|
| 114 | - try { |
|
| 116 | + if ($count > $this->maxFiles) |
|
| 117 | + { |
|
| 118 | + try |
|
| 119 | + { |
|
| 115 | 120 | $this->files->delete($file->getRealPath()); |
| 116 | - } catch (FilesException $e) { |
|
| 121 | + } |
|
| 122 | + catch (FilesException $e) |
|
| 123 | + { |
|
| 117 | 124 | // ignore |
| 118 | 125 | } |
| 119 | 126 | } |
@@ -124,9 +124,9 @@ |
||
| 124 | 124 | */ |
| 125 | 125 | public function getActiveSession(): SessionInterface |
| 126 | 126 | { |
| 127 | - try { |
|
| 127 | + try{ |
|
| 128 | 128 | return $this->container->get(SessionInterface::class); |
| 129 | - } catch (NotFoundExceptionInterface $e) { |
|
| 129 | + }catch (NotFoundExceptionInterface $e){ |
|
| 130 | 130 | throw new ScopeException( |
| 131 | 131 | 'Unable to receive active session, invalid request scope', |
| 132 | 132 | $e->getCode(), |
@@ -124,9 +124,12 @@ |
||
| 124 | 124 | */ |
| 125 | 125 | public function getActiveSession(): SessionInterface |
| 126 | 126 | { |
| 127 | - try { |
|
| 127 | + try |
|
| 128 | + { |
|
| 128 | 129 | return $this->container->get(SessionInterface::class); |
| 129 | - } catch (NotFoundExceptionInterface $e) { |
|
| 130 | + } |
|
| 131 | + catch (NotFoundExceptionInterface $e) |
|
| 132 | + { |
|
| 130 | 133 | throw new ScopeException( |
| 131 | 134 | 'Unable to receive active session, invalid request scope', |
| 132 | 135 | $e->getCode(), |