| @@ -41,12 +41,12 @@ | ||
| 41 | 41 | $phpVersion = $this->getPhpVersion(); | 
| 42 | 42 |          if (null !== $this->greaterEquals && !version_compare($this->greaterEquals, $phpVersion, '<=')) { | 
| 43 | 43 | $result->setSuccess(false); | 
| 44 | -            $result->setError("PHP version must be >= {$this->greaterEquals}; is " . $phpVersion); | |
| 44 | +            $result->setError("PHP version must be >= {$this->greaterEquals}; is ".$phpVersion); | |
| 45 | 45 | } | 
| 46 | 46 | |
| 47 | 47 |          if (null !== $this->lessThan && !version_compare($this->lessThan, $phpVersion, '>')) { | 
| 48 | 48 | $result->setSuccess(false); | 
| 49 | -            $result->setError("PHP version must be < {$this->lessThan}; is " . $phpVersion); | |
| 49 | +            $result->setError("PHP version must be < {$this->lessThan}; is ".$phpVersion); | |
| 50 | 50 | } | 
| 51 | 51 | |
| 52 | 52 | return $result; | 
| @@ -33,15 +33,15 @@ | ||
| 33 | 33 |          switch (substr($sizeStr, -1)) { | 
| 34 | 34 | case 'M': | 
| 35 | 35 | case 'm': | 
| 36 | - return (int)$sizeStr; | |
| 36 | + return (int) $sizeStr; | |
| 37 | 37 | |
| 38 | 38 | case 'K': | 
| 39 | 39 | case 'k': | 
| 40 | - return (int)$sizeStr / 1024; | |
| 40 | + return (int) $sizeStr / 1024; | |
| 41 | 41 | |
| 42 | 42 | case 'G': | 
| 43 | 43 | case 'g': | 
| 44 | - return (int)$sizeStr * 1024; | |
| 44 | + return (int) $sizeStr * 1024; | |
| 45 | 45 | |
| 46 | 46 | default: | 
| 47 | 47 | return $sizeStr; | 
| @@ -38,10 +38,10 @@ discard block | ||
| 38 | 38 |      { | 
| 39 | 39 | $strings = []; | 
| 40 | 40 |          if (null !== $this->greaterEquals) { | 
| 41 | - $strings[] = '>=' . $this->greaterEquals; | |
| 41 | + $strings[] = '>='.$this->greaterEquals; | |
| 42 | 42 | } | 
| 43 | 43 |          if (null !== $this->lessThan) { | 
| 44 | - $strings[] = '<' . $this->lessThan; | |
| 44 | + $strings[] = '<'.$this->lessThan; | |
| 45 | 45 | } | 
| 46 | 46 | |
| 47 | 47 |          return implode(' and ', $strings); | 
| @@ -80,11 +80,11 @@ discard block | ||
| 80 | 80 | if ((null !== $this->greaterEquals && !version_compare($this->greaterEquals, $version, '<=')) || | 
| 81 | 81 |                  (null !== $this->lessThan && !version_compare($this->lessThan, $version, '>'))) { | 
| 82 | 82 | $result->setSuccess(false); | 
| 83 | -                $result->setError('Extension ' . $this->extension . ' loaded, but version ' . $version . ' not supported<br/>Version must be ' . $this->getVersionConstraintString()); | |
| 83 | +                $result->setError('Extension '.$this->extension.' loaded, but version '.$version.' not supported<br/>Version must be '.$this->getVersionConstraintString()); | |
| 84 | 84 | } | 
| 85 | 85 |          } else { | 
| 86 | 86 | $result->setSuccess(false); | 
| 87 | -            $result->setError('Extension ' . $this->extension . ' is missing'); | |
| 87 | +            $result->setError('Extension '.$this->extension.' is missing'); | |
| 88 | 88 | } | 
| 89 | 89 | |
| 90 | 90 | return $result; | 
| @@ -32,7 +32,7 @@ discard block | ||
| 32 | 32 | |
| 33 | 33 | public function check(): void | 
| 34 | 34 |      { | 
| 35 | -        foreach($this->results as $group) { | |
| 35 | +        foreach ($this->results as $group) { | |
| 36 | 36 | $group->check(); | 
| 37 | 37 | } | 
| 38 | 38 | } | 
| @@ -45,7 +45,7 @@ discard block | ||
| 45 | 45 | public function hasErrors(): bool | 
| 46 | 46 |      { | 
| 47 | 47 | $error = false; | 
| 48 | -        foreach($this->results as $group) { | |
| 48 | +        foreach ($this->results as $group) { | |
| 49 | 49 |              if ($group->hasErrors()) { | 
| 50 | 50 | $error = true; | 
| 51 | 51 | break; | 
| @@ -1,5 +1,5 @@ discard block | ||
| 1 | 1 | <?php | 
| 2 | -require __DIR__ . '/../vendor/autoload.php'; | |
| 2 | +require __DIR__.'/../vendor/autoload.php'; | |
| 3 | 3 | |
| 4 | 4 | use BretRZaun\StatusPage\Check\PhpExtensionCheck; | 
| 5 | 5 | use BretRZaun\StatusPage\Check\PhpIniCheck; | 
| @@ -44,10 +44,10 @@ discard block | ||
| 44 | 44 | |
| 45 | 45 | // determine if the user is allowed to see the details (based on their IP) | 
| 46 | 46 | $whitelistPattern = '.*'; // this intentionally matches everything | 
| 47 | -$showDetails = (bool)preg_match('|(?mi-Us)' . $whitelistPattern . '|', $_SERVER['REMOTE_ADDR']); | |
| 47 | +$showDetails = (bool) preg_match('|(?mi-Us)'.$whitelistPattern.'|', $_SERVER['REMOTE_ADDR']); | |
| 48 | 48 | |
| 49 | 49 | // use the built-in Twig template | 
| 50 | -$loader = new Twig_Loader_Filesystem(__DIR__ . '/../resources/views/'); | |
| 50 | +$loader = new Twig_Loader_Filesystem(__DIR__.'/../resources/views/'); | |
| 51 | 51 | $twig = new Twig_Environment($loader, ['autoescape' => false]); | 
| 52 | 52 | |
| 53 | 53 | $content = $twig->render( | 
| @@ -97,9 +97,9 @@ discard block | ||
| 97 | 97 |                  $result->setError("mtime() returns error"); | 
| 98 | 98 | return $result; | 
| 99 | 99 | } | 
| 100 | - $age = (time()-$mtime); | |
| 101 | - $age = round($age/60); // sec-to-min | |
| 102 | -            if ($age > (int)$this->maxage) { | |
| 100 | + $age = (time() - $mtime); | |
| 101 | + $age = round($age / 60); // sec-to-min | |
| 102 | +            if ($age > (int) $this->maxage) { | |
| 103 | 103 | $result->setSuccess(false); | 
| 104 | 104 | $result->setError($this->filename." is to old!"); | 
| 105 | 105 | return $result; | 
| @@ -120,7 +120,7 @@ discard block | ||
| 120 | 120 | return $result; | 
| 121 | 121 | } | 
| 122 | 122 | $linenr = 0; | 
| 123 | -            while($line = fgets($fp)) { | |
| 123 | +            while ($line = fgets($fp)) { | |
| 124 | 124 | $linenr++; | 
| 125 | 125 |                  if (preg_match('~'.$this->unwantedRegex.'~i', $line)) { | 
| 126 | 126 | $result->setSuccess(false); | 
| @@ -47,7 +47,7 @@ discard block | ||
| 47 | 47 | */ | 
| 48 | 48 | public function check(): void | 
| 49 | 49 |      { | 
| 50 | -        foreach($this->checks as $checker) { | |
| 50 | +        foreach ($this->checks as $checker) { | |
| 51 | 51 | /* @var $checker CheckInterface */ | 
| 52 | 52 | $this->results[] = $checker->checkStatus(); | 
| 53 | 53 | } | 
| @@ -71,7 +71,7 @@ discard block | ||
| 71 | 71 | public function hasErrors(): bool | 
| 72 | 72 |      { | 
| 73 | 73 | $error = false; | 
| 74 | -        foreach($this->results as $result) { | |
| 74 | +        foreach ($this->results as $result) { | |
| 75 | 75 |              if (!$result->getSuccess()) { | 
| 76 | 76 | $error = true; | 
| 77 | 77 | break; | 
| @@ -29,7 +29,7 @@ discard block | ||
| 29 | 29 | * | 
| 30 | 30 | * @return PhpIniCheck | 
| 31 | 31 | */ | 
| 32 | - public function __construct(string $label, string $varName, string $varType, $varValue, $maxValue=null) | |
| 32 | + public function __construct(string $label, string $varName, string $varType, $varValue, $maxValue = null) | |
| 33 | 33 |      { | 
| 34 | 34 | parent::__construct($label); | 
| 35 | 35 | $this->varName = $varName; | 
| @@ -45,14 +45,14 @@ discard block | ||
| 45 | 45 | */ | 
| 46 | 46 | protected function stringToMegabyte(string $size) | 
| 47 | 47 |      { | 
| 48 | -        $value = preg_replace('~[^0-9]*~','', $size); | |
| 48 | +        $value = preg_replace('~[^0-9]*~', '', $size); | |
| 49 | 49 |          switch (substr(strtolower($size), -1)) { | 
| 50 | 50 | case 'm': | 
| 51 | - return (int)$value; | |
| 51 | + return (int) $value; | |
| 52 | 52 | case 'k': | 
| 53 | - return round((int)$value / 1024); | |
| 53 | + return round((int) $value / 1024); | |
| 54 | 54 | case 'g': | 
| 55 | - return ((int)$value * 1024); | |
| 55 | + return ((int) $value * 1024); | |
| 56 | 56 | default: | 
| 57 | 57 | return false; | 
| 58 | 58 | } | 
| @@ -78,7 +78,7 @@ discard block | ||
| 78 | 78 | default: | 
| 79 | 79 | $result = new Result($this->label); | 
| 80 | 80 | $result->setSuccess(false); | 
| 81 | -                $result->setError("Invalid Type: " . $this->varType); | |
| 81 | +                $result->setError("Invalid Type: ".$this->varType); | |
| 82 | 82 | return $result; | 
| 83 | 83 | } | 
| 84 | 84 | } | 
| @@ -105,7 +105,7 @@ discard block | ||
| 105 | 105 | break; | 
| 106 | 106 | } | 
| 107 | 107 | |
| 108 | - $result->setSuccess( boolval($this->iniValue) === boolval($this->varValue) ); | |
| 108 | + $result->setSuccess(boolval($this->iniValue) === boolval($this->varValue)); | |
| 109 | 109 |          $result->setError("php.ini value of '".$this->varName."' is set to '".strval(boolval($this->iniValue))."' instead of expected '".strval(boolval($this->varValue))."'"); | 
| 110 | 110 | return $result; | 
| 111 | 111 | } | 
| @@ -118,7 +118,7 @@ discard block | ||
| 118 | 118 | $result = new Result($this->label); | 
| 119 | 119 |          if ($this->iniValue != -1) { | 
| 120 | 120 | $value = $this->stringToMegabyte($this->iniValue); | 
| 121 | - $result->setSuccess( $value >= $this->varValue ); | |
| 121 | + $result->setSuccess($value >= $this->varValue); | |
| 122 | 122 |              $result->setError("php.ini value of '".$this->varName."' is set to '".strval($this->iniValue)."', minimum expected is '".strval($this->varValue)."'"); | 
| 123 | 123 | } | 
| 124 | 124 | return $result; | 
| @@ -165,7 +165,7 @@ discard block | ||
| 165 | 165 | protected function checkString() | 
| 166 | 166 |      { | 
| 167 | 167 | $result = new Result($this->label); | 
| 168 | - $result->setSuccess( strval($this->iniValue) == strval($this->varValue) ); | |
| 168 | + $result->setSuccess(strval($this->iniValue) == strval($this->varValue)); | |
| 169 | 169 |          $result->setError("php.ini value of '".$this->varName."' is set to '".strval($this->iniValue)."', expected is '".strval($this->varValue)."'"); | 
| 170 | 170 | return $result; | 
| 171 | 171 | } |