mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-14 07:28:41 +00:00
Merge pull request #17 from Orange-Management/scrutinizer-patch-1
Scrutinizer Auto-Fixes
This commit is contained in:
commit
bde9db585e
|
|
@ -94,17 +94,23 @@ class Numbers
|
|||
|
||||
// This tests if the 6 least significant bits are right.
|
||||
// Moving the to be tested bit to the highest position saves us masking.
|
||||
if ($goodMask << $n >= 0) return false;
|
||||
if ($goodMask << $n >= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$numberOfTrailingZeros = self::countTrailingZeros($n);
|
||||
// Each square ends with an even number of zeros.
|
||||
if (($numberOfTrailingZeros & 1) !== 0) return false;
|
||||
if (($numberOfTrailingZeros & 1) !== 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$n >>= $numberOfTrailingZeros;
|
||||
// Now x is either 0 or odd.
|
||||
// In binary each odd square ends with 001.
|
||||
// Postpone the sign test until now; handle zero in the branch.
|
||||
if (($n&7) != 1 | $n <= 0) return $n === 0;
|
||||
if (($n&7) != 1 | $n <= 0) {
|
||||
return $n === 0;
|
||||
}
|
||||
// Do it in the classical way.
|
||||
// The correctness is not trivial as the conversion from long to double is lossy!
|
||||
$tst = (int) sqrt($n);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,9 @@ class GaussianElimination
|
|||
{
|
||||
private function swapRows(&$a, &$b, $r1, $r2)
|
||||
{
|
||||
if ($r1 == $r2) return;
|
||||
if ($r1 == $r2) {
|
||||
return;
|
||||
}
|
||||
|
||||
$tmp = $a[$r1];
|
||||
$a[$r1] = $a[$r2];
|
||||
|
|
|
|||
|
|
@ -329,7 +329,9 @@ class Average
|
|||
$avgcos = $coss / (0.0 + count($angles));
|
||||
$avgang = rad2deg(atan2($avgsin, $avgcos));
|
||||
|
||||
while ($avgang < 0.0) $avgang += 360.0;
|
||||
while ($avgang < 0.0) {
|
||||
$avgang += 360.0;
|
||||
}
|
||||
|
||||
return $avgang;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -584,14 +584,18 @@ class Markdown
|
|||
if (isset($block['closed'])) {
|
||||
return null;
|
||||
}
|
||||
if (preg_match('/^<' . $block['name'] . '(?:[ ]*' . $this->regexHtmlAttribute . ')*[ ]*>/i', $line['text'])) # open
|
||||
if (preg_match('/^<' . $block['name'] . '(?:[ ]*' . $this->regexHtmlAttribute . ')*[ ]*>/i', $line['text'])) {
|
||||
# open
|
||||
{
|
||||
$block['depth']++;
|
||||
}
|
||||
if (preg_match('/(.*?)<\/' . $block['name'] . '>[ ]*$/i', $line['text'], $matches)) # close
|
||||
}
|
||||
if (preg_match('/(.*?)<\/' . $block['name'] . '>[ ]*$/i', $line['text'], $matches)) {
|
||||
# close
|
||||
{
|
||||
if ($block['depth'] > 0) {
|
||||
$block['depth']--;
|
||||
}
|
||||
} else {
|
||||
$block['closed'] = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -491,10 +491,14 @@ class Interval
|
|||
private function validateMinute(array $array) : bool
|
||||
{
|
||||
foreach ($array['minutes'] as $minute) {
|
||||
if ($minute > 59 || $minute < 0) return false;
|
||||
if ($minute > 59 || $minute < 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ($array['step'] > 59 || $array['step'] < 0) return false;
|
||||
if ($array['step'] > 59 || $array['step'] < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -512,10 +516,14 @@ class Interval
|
|||
private function validateHour(array $array) : bool
|
||||
{
|
||||
foreach ($array['hours'] as $hour) {
|
||||
if ($hour > 23 || $hour < 0) return false;
|
||||
if ($hour > 23 || $hour < 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ($array['step'] > 23 || $array['step'] < 0) return false;
|
||||
if ($array['step'] > 23 || $array['step'] < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -533,11 +541,17 @@ class Interval
|
|||
private function validateDayOfMonth(array $array) : bool
|
||||
{
|
||||
foreach ($array['dayOfMonth'] as $dayOfMonth) {
|
||||
if ($dayOfMonth > 31 || $dayOfMonth < 1) return false;
|
||||
if ($dayOfMonth > 31 || $dayOfMonth < 1) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ($array['step'] > 31 || $array['step'] < 1) return false;
|
||||
if ($array['nearest'] > 31 || $array['nearest'] < 1) return false;
|
||||
if ($array['step'] > 31 || $array['step'] < 1) {
|
||||
return false;
|
||||
}
|
||||
if ($array['nearest'] > 31 || $array['nearest'] < 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -555,10 +569,14 @@ class Interval
|
|||
private function validateMonth(array $array) : bool
|
||||
{
|
||||
foreach ($array['month'] as $month) {
|
||||
if ($month > 12 || $month < 1) return false;
|
||||
if ($month > 12 || $month < 1) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ($array['step'] > 12 || $array['step'] < 1) return false;
|
||||
if ($array['step'] > 12 || $array['step'] < 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -576,10 +594,14 @@ class Interval
|
|||
private function validateDayOfWeek(array $array) : bool
|
||||
{
|
||||
foreach ($array['dayOfWeek'] as $dayOfWeek) {
|
||||
if ($dayOfWeek > 7 || $dayOfWeek < 1) return false;
|
||||
if ($dayOfWeek > 7 || $dayOfWeek < 1) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ($array['step'] > 5 || $array['step'] < 1) return false;
|
||||
if ($array['step'] > 5 || $array['step'] < 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user