@@ -30,29 +30,37 @@ |
||
| 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 | 38 | $fp = false; |
| 38 | 39 | $lock = false; |
| 39 | 40 | |
| 40 | - try { |
|
| 41 | + try |
|
| 42 | + { |
|
| 41 | 43 | $fp = \fopen($filename, 'r'); |
| 42 | - if ($fp === false) { |
|
| 44 | + if ($fp === false) |
|
| 45 | + { |
|
| 43 | 46 | return null; |
| 44 | 47 | } |
| 45 | 48 | |
| 46 | 49 | $lock = \flock($fp, \LOCK_SH | \LOCK_NB); |
| 47 | 50 | |
| 48 | - if ($lock === false) { |
|
| 51 | + if ($lock === false) |
|
| 52 | + { |
|
| 49 | 53 | return null; |
| 50 | 54 | } |
| 51 | 55 | |
| 52 | 56 | return include($filename); |
| 53 | - } catch (\Throwable) { |
|
| 57 | + } |
|
| 58 | + catch (\Throwable) |
|
| 59 | + { |
|
| 54 | 60 | return null; |
| 55 | - } finally { |
|
| 61 | + } |
|
| 62 | + finally |
|
| 63 | + { |
|
| 56 | 64 | $lock === false or \flock($fp, \LOCK_UN); |
| 57 | 65 | $fp === false or \fclose($fp); |
| 58 | 66 | } |