@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | public function __construct( |
| 20 | 20 | string $directory, |
| 21 | 21 | private readonly FilesInterface $files |
| 22 | - ) { |
|
| 22 | + ){ |
|
| 23 | 23 | $this->directory = \rtrim($directory, '/'); |
| 24 | 24 | } |
| 25 | 25 | |
@@ -30,20 +30,20 @@ discard block |
||
| 30 | 30 | { |
| 31 | 31 | $filename = $this->getFilename($section); |
| 32 | 32 | |
| 33 | - if (!\file_exists($filename)) { |
|
| 33 | + if (!\file_exists($filename)){ |
|
| 34 | 34 | return null; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - try { |
|
| 37 | + try{ |
|
| 38 | 38 | $fp = fopen($filename, 'r'); |
| 39 | - if (!flock($fp, LOCK_SH)) { |
|
| 39 | + if (!flock($fp, LOCK_SH)){ |
|
| 40 | 40 | return null; |
| 41 | 41 | } |
| 42 | 42 | $data = include($filename); |
| 43 | 43 | flock($fp, LOCK_UN); |
| 44 | 44 | fclose($fp); |
| 45 | 45 | return $data; |
| 46 | - } catch (\Throwable) { |
|
| 46 | + }catch (\Throwable){ |
|
| 47 | 47 | return null; |
| 48 | 48 | } |
| 49 | 49 | } |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | { |
| 53 | 53 | $this->files->write( |
| 54 | 54 | $this->getFilename($section), |
| 55 | - '<?php return ' . \var_export($data, true) . ';', |
|
| 55 | + '<?php return '.\var_export($data, true).';', |
|
| 56 | 56 | FilesInterface::RUNTIME, |
| 57 | 57 | true |
| 58 | 58 | ); |
@@ -30,20 +30,25 @@ |
||
| 30 | 30 | { |
| 31 | 31 | $filename = $this->getFilename($section); |
| 32 | 32 | |
| 33 | - if (!\file_exists($filename)) { |
|
| 33 | + if (!\file_exists($filename)) |
|
| 34 | + { |
|
| 34 | 35 | return null; |
| 35 | 36 | } |
| 36 | 37 | |
| 37 | - try { |
|
| 38 | + try |
|
| 39 | + { |
|
| 38 | 40 | $fp = fopen($filename, 'r'); |
| 39 | - if (!flock($fp, LOCK_SH)) { |
|
| 41 | + if (!flock($fp, LOCK_SH)) |
|
| 42 | + { |
|
| 40 | 43 | return null; |
| 41 | 44 | } |
| 42 | 45 | $data = include($filename); |
| 43 | 46 | flock($fp, LOCK_UN); |
| 44 | 47 | fclose($fp); |
| 45 | 48 | return $data; |
| 46 | - } catch (\Throwable) { |
|
| 49 | + } |
|
| 50 | + catch (\Throwable) |
|
| 51 | + { |
|
| 47 | 52 | return null; |
| 48 | 53 | } |
| 49 | 54 | } |