@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @author Georges.L (Geolim4) <[email protected]> |
12 | 12 | * |
13 | 13 | */ |
14 | -declare(strict_types=1); |
|
14 | +declare(strict_types = 1); |
|
15 | 15 | |
16 | 16 | namespace Phpfastcache; |
17 | 17 | |
@@ -64,29 +64,29 @@ discard block |
||
64 | 64 | */ |
65 | 65 | static $version; |
66 | 66 | |
67 | - if($version && $cacheable){ |
|
67 | + if ($version && $cacheable) { |
|
68 | 68 | return $version; |
69 | 69 | } |
70 | 70 | |
71 | - if(\function_exists('shell_exec')){ |
|
71 | + if (\function_exists('shell_exec')) { |
|
72 | 72 | $stdout = shell_exec('git describe --abbrev=0 --tags'); |
73 | - if(\is_string($stdout)){ |
|
73 | + if (\is_string($stdout)) { |
|
74 | 74 | $version = \trim($stdout); |
75 | 75 | return $version; |
76 | 76 | } |
77 | 77 | throw new phpFastCacheLogicException('The git command used to retrieve the PhpFastCache version has failed.'); |
78 | 78 | } |
79 | 79 | |
80 | - if(!$fallbackOnChangelog){ |
|
80 | + if (!$fallbackOnChangelog) { |
|
81 | 81 | throw new phpFastCacheLogicException('shell_exec is disabled therefore the PhpFastCache version cannot be retrieved.'); |
82 | 82 | } |
83 | 83 | |
84 | 84 | $changelogFilename = __DIR__ . '/../../CHANGELOG.md'; |
85 | - if(\file_exists($changelogFilename)){ |
|
85 | + if (\file_exists($changelogFilename)) { |
|
86 | 86 | $versionPrefix = '## '; |
87 | 87 | $changelog = \explode("\n", self::getPhpFastCacheChangelog()); |
88 | - foreach ($changelog as $line){ |
|
89 | - if(\strpos($line, $versionPrefix) === 0){ |
|
88 | + foreach ($changelog as $line) { |
|
89 | + if (\strpos($line, $versionPrefix) === 0) { |
|
90 | 90 | $version = \trim(\str_replace($versionPrefix, '', $line)); |
91 | 91 | return $version; |
92 | 92 | } |
@@ -104,13 +104,13 @@ discard block |
||
104 | 104 | { |
105 | 105 | static $hash; |
106 | 106 | |
107 | - if($hash && $cacheable){ |
|
107 | + if ($hash && $cacheable) { |
|
108 | 108 | return $hash; |
109 | 109 | } |
110 | 110 | |
111 | - if(\function_exists('shell_exec')){ |
|
111 | + if (\function_exists('shell_exec')) { |
|
112 | 112 | $stdout = shell_exec('git rev-parse --short HEAD'); |
113 | - if(\is_string($stdout)){ |
|
113 | + if (\is_string($stdout)) { |
|
114 | 114 | $hash = \trim($stdout); |
115 | 115 | return "#{$hash}"; |
116 | 116 | } |
@@ -128,9 +128,9 @@ discard block |
||
128 | 128 | public static function getChangelog(): string |
129 | 129 | { |
130 | 130 | $changelogFilename = __DIR__ . '/../../CHANGELOG_API.md'; |
131 | - if(\file_exists($changelogFilename)){ |
|
131 | + if (\file_exists($changelogFilename)) { |
|
132 | 132 | $string = \str_replace(["\r\n", "\r"], "\n", \trim(file_get_contents($changelogFilename))); |
133 | - if($string){ |
|
133 | + if ($string) { |
|
134 | 134 | return $string; |
135 | 135 | } |
136 | 136 | throw new phpFastCacheLogicException('Unable to retrieve the PhpFastCache API changelog as it seems to be empty.'); |
@@ -147,9 +147,9 @@ discard block |
||
147 | 147 | public static function getPhpFastCacheChangelog(): string |
148 | 148 | { |
149 | 149 | $changelogFilename = __DIR__ . '/../../CHANGELOG.md'; |
150 | - if(\file_exists($changelogFilename)){ |
|
150 | + if (\file_exists($changelogFilename)) { |
|
151 | 151 | $string = \str_replace(["\r\n", "\r"], "\n", \trim(file_get_contents($changelogFilename))); |
152 | - if($string){ |
|
152 | + if ($string) { |
|
153 | 153 | return $string; |
154 | 154 | } |
155 | 155 | throw new phpFastCacheLogicException('Unable to retrieve the PhpFastCache changelog as it seems to be empty.'); |