Scrutinizer Auto-Fixes

This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
This commit is contained in:
Scrutinizer Auto-Fixer 2016-03-28 14:44:47 +00:00
parent cef703a378
commit 114ce12de8
41 changed files with 171 additions and 135 deletions

View File

@ -364,7 +364,7 @@ class Account
*/
public function setEmail(string $email)
{
if(!Email::isValid($email)) {
if (!Email::isValid($email)) {
throw new \InvalidArgumentException();
}
@ -383,7 +383,7 @@ class Account
*/
public function setStatus(int $status)
{
if(!AccountStatus::isValidValue($status)) {
if (!AccountStatus::isValidValue($status)) {
throw new \InvalidArgumentException();
}
@ -402,7 +402,7 @@ class Account
*/
public function setType(int $type)
{
if(!AccountType::isValidValue($type)) {
if (!AccountType::isValidValue($type)) {
throw new \InvalidArgumentException();
}

View File

@ -126,7 +126,7 @@ abstract class SettingsAbstract implements OptionsInterface
{
$this->setOptions($options);
if($store) {
if ($store) {
// save to db
}
}

View File

@ -72,7 +72,7 @@ class CookieJar
public function save()
{
if(self::$isLocked) {
if (self::$isLocked) {
throw new \Exception('Already locked');
}

View File

@ -1000,11 +1000,11 @@ abstract class DataMapperAbstract implements DataMapperInterface
$query = new Builder($this->db);
$query->prefix($this->db->getPrefix());
if($relations === RelationType::ALL) {
if ($relations === RelationType::ALL) {
$query->select($value['table'] . '.' . $value['src'])
->from($value['table'])
->where($value['table'] . '.' . $value['dst'], '=', $primaryKey);
} elseif($relations === RelationType::NEWEST) {
} elseif ($relations === RelationType::NEWEST) {
/*
SELECT c.*, p1.*

View File

@ -78,7 +78,7 @@ abstract class GrammarAbstract
implode(' ',
array_filter(
$this->compileComponents($query),
function ($value) {
function($value) {
return (string) $value !== '';
}
)
@ -135,7 +135,7 @@ abstract class GrammarAbstract
{
// todo: move remaining * test also here not just if .* but also if * (should be done in else?)
if (count($split = explode('.', $system)) == 2) {
if($split[1] === '*') {
if ($split[1] === '*') {
$system = $split[1];
} else {
$system = $this->compileSystem($split[1]);

View File

@ -60,7 +60,7 @@ class HttpSession implements SessionInterface
*/
public function __construct(int $liftetime = 3600, $sid = false)
{
if(self::$isLocked) {
if (self::$isLocked) {
throw new \Exception('Already locked');
}
@ -89,7 +89,7 @@ class HttpSession implements SessionInterface
{
$this->set('UID', 0, false);
if(($CSRF = $this->get('CSRF')) === null) {
if (($CSRF = $this->get('CSRF')) === null) {
$CSRF = StringUtils::generateString(10, 16);
$this->set('CSRF', $CSRF, false);
}
@ -110,7 +110,7 @@ class HttpSession implements SessionInterface
*/
public function set($key, $value, bool $overwrite = true) : bool
{
if($overwrite || !isset($this->sessionData[$key])) {
if ($overwrite || !isset($this->sessionData[$key])) {
$this->sessionData[$key] = $value;
return true;

View File

@ -36,7 +36,7 @@ class SmartDateTime extends \DateTime
* @var string
* @since 1.0.0
*/
const FORMAT = 'Y-m-d hh:mm:ss';
const FORMAT = 'Y-m-d hh:mm:ss';
/**
* Default timezone

View File

@ -71,7 +71,7 @@ class L11nManager
*/
public function loadLanguage(string $language, string $from, array $files)
{
if(!isset($files[$from])) {
if (!isset($files[$from])) {
throw new \Exception('Unexpected language key: ' . $from);
}

View File

@ -125,7 +125,7 @@ class Localization
*/
public function setCountry(string $country)
{
if(!ISO3166Enum::isValidValue($country)) {
if (!ISO3166Enum::isValidValue($country)) {
throw new InvalidEnumValue($country);
}
@ -153,7 +153,7 @@ class Localization
*/
public function setTimezone(string $timezone)
{
if(!TimeZoneEnumArray::isValidValue($timezone)) {
if (!TimeZoneEnumArray::isValidValue($timezone)) {
throw new InvalidEnumValue($timezone);
}
@ -181,7 +181,7 @@ class Localization
*/
public function setLanguage(string $language)
{
if(!ISO639x1Enum::isValidValue($language)) {
if (!ISO639x1Enum::isValidValue($language)) {
throw new InvalidEnumValue($language);
}
@ -233,7 +233,7 @@ class Localization
*/
public function setCurrency(string $currency)
{
if(!ISO4217Enum::isValidValue($currency)) {
if (!ISO4217Enum::isValidValue($currency)) {
throw new InvalidEnumValue($currency);
}

View File

@ -290,13 +290,13 @@ class FileLogger implements LoggerInterface
{
$this->fp = fopen($this->path, 'a');
if($this->fp !== false) {
if ($this->fp !== false) {
fwrite($this->fp, $message . "\n");
fclose($this->fp);
$this->fp = false;
}
if(self::$verbose) {
if (self::$verbose) {
echo $message . "\n";
}
}

View File

@ -38,7 +38,7 @@ class PointPolygonIntersection
}
// Inside or ontop?
$countIntersect = 0;
$countIntersect = 0;
$vertices_count = count($vertices);
// todo: return based on highest possibility not by first match

View File

@ -31,12 +31,12 @@ class Fibunacci
{
public static function isFibunacci(int $n)
{
return Functions::isSquare(5*$n**2+4) || Functions::isSquare(5*$n**2-4);
return Functions::isSquare(5 * $n**2 + 4) || Functions::isSquare(5 * $n**2 - 4);
}
public static function fibunacci(int $n, int $start = 1) : int
{
if($n < 2) {
if ($n < 2) {
return 0;
} elseif ($n < 4) {
return $start;
@ -57,6 +57,6 @@ class Fibunacci
public static function binet(int $n) : int
{
return (int) (((1+sqrt(5))**$n - (1-sqrt(5))**$n)/(2**$n * sqrt(5)));
return (int) (((1 + sqrt(5))**$n - (1 - sqrt(5))**$n) / (2**$n * sqrt(5)));
}
}

View File

@ -129,13 +129,13 @@ class Functions
*/
public static function ackermann(int $m, int $n) : int
{
if($m === 0) {
return $n+1;
} elseif($n === 0) {
return self::ackermann($m-1, 1);
if ($m === 0) {
return $n + 1;
} elseif ($n === 0) {
return self::ackermann($m - 1, 1);
}
return ackermann($m-1, ackermann($m, $n-1));
return ackermann($m - 1, ackermann($m, $n - 1));
}
/**
@ -149,7 +149,7 @@ class Functions
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public static function invMod($a, $n){
public static function invMod($a, $n) {
if ($n < 0) {
$n = -$n;
}
@ -164,12 +164,12 @@ class Functions
$nr = $a % $n;
while ($nr != 0) {
$quot = (int) ($r/$nr);
$quot = (int) ($r / $nr);
$tmp = $nt;
$nt = $t - $quot*$nt;
$nt = $t - $quot * $nt;
$t = $tmp;
$tmp = $nr;
$nr = $r - $quot*$nr;
$nr = $r - $quot * $nr;
$r = $tmp;
}

View File

@ -14,14 +14,14 @@ class Matrix implements ArrayAccess, Iterator
$this->n = $n;
$this->m = $m;
for($i = 0; $i < $m; $i++) {
for ($i = 0; $i < $m; $i++) {
$this->matrix[$i] = array_fill(0, $n, 0);
}
}
public function setMatrix(array $matrix)
{
if($this->m !== count($matrix) || $this->n !== count($matrix[0])) {
if ($this->m !== count($matrix) || $this->n !== count($matrix[0])) {
throw new \Exception('Dimension');
}
@ -53,9 +53,9 @@ class Matrix implements ArrayAccess, Iterator
public function mult($value) : Matrix
{
if($value instanceOf Matrix) {
if ($value instanceOf Matrix) {
return $this->multMatrix($value);
} elseif(is_scalar($value)) {
} elseif (is_scalar($value)) {
return $this->multScalar($value);
}
}
@ -65,7 +65,7 @@ class Matrix implements ArrayAccess, Iterator
$nDim = $matrix->getN();
$mDim = $matrix->getM();
if($this->n !== $mDim) {
if ($this->n !== $mDim) {
throw new \Exception('Dimension');
}
@ -73,11 +73,11 @@ class Matrix implements ArrayAccess, Iterator
$newMatrix = new Matrix($this->m, $nDim);
$newMatrixArr = $newMatrix->getMatrix();
for($i = 0; $i < $this->m; $i++) { // Row of $this
for($c = 0; $c < $nDim; $c++) { // Column of $matrix
for ($i = 0; $i < $this->m; $i++) { // Row of $this
for ($c = 0; $c < $nDim; $c++) { // Column of $matrix
$temp = 0;
for($j = 0; $j < $mDim; $i++) { // Row of $matrix
for ($j = 0; $j < $mDim; $i++) { // Row of $matrix
$temp += $this->matrix[$i][$j] * $matrixArr[$j][$c];
}
@ -94,8 +94,8 @@ class Matrix implements ArrayAccess, Iterator
{
$newMatrixArr = $this->matrix;
foreach($newMatrixArr as $i => $vector) {
foreach($vector as $j => $value) {
foreach ($newMatrixArr as $i => $vector) {
foreach ($vector as $j => $value) {
$newMatrixArr[$i][$j] *= $value;
}
}
@ -108,33 +108,33 @@ class Matrix implements ArrayAccess, Iterator
public function add($value) : Matrix
{
if($value instanceOf Matrix) {
if ($value instanceOf Matrix) {
return $this->addMatrix($value);
} elseif(is_scalar($value)) {
} elseif (is_scalar($value)) {
return $this->addScalar($value);
}
}
public function sub($value) : Matrix
{
if($value instanceOf Matrix) {
if ($value instanceOf Matrix) {
return $this->add($this->multMatrix(-1));
} elseif(is_scalar($value)) {
} elseif (is_scalar($value)) {
return $this->addScalar(-$value);
}
}
private function addMatrix(Matrix $value) : Matrix
{
if($this->m !== $value->getM() || $this->n !== $value->getN()) {
if ($this->m !== $value->getM() || $this->n !== $value->getN()) {
throw new \Exception('Dimension');
}
$matrixArr = $value->getMatrix();
$newMatrixArr = $this->matrix;
foreach($newMatrixArr as $i => $vector) {
foreach($vector as $j => $value) {
foreach ($newMatrixArr as $i => $vector) {
foreach ($vector as $j => $value) {
$newMatrixArr[$i][$j] += $matrixArr[$i][$j];
}
}
@ -149,8 +149,8 @@ class Matrix implements ArrayAccess, Iterator
{
$newMatrixArr = $this->matrix;
foreach($newMatrixArr as $i => $vector) {
foreach($vector as $j => $value) {
foreach ($newMatrixArr as $i => $vector) {
foreach ($vector as $j => $value) {
$newMatrixArr[$i][$j] += $value;
}
}
@ -184,11 +184,11 @@ class Matrix implements ArrayAccess, Iterator
public function inverse(int $algorithm = InversionType::GAUSS_JORDAN) : Matrix
{
if($this->n !== $this->m) {
if ($this->n !== $this->m) {
throw new \Exception('Dimension');
}
switch($algorithm) {
switch ($algorithm) {
case InversionType::GAUSS_JORDAN:
return $this->inverseGaussJordan();
default:
@ -201,10 +201,10 @@ class Matrix implements ArrayAccess, Iterator
$newMatrixArr = $this->matrix;
// extending matrix by identity matrix
for($i = 0; $i < $this->n; $i++) {
for($j = $this->n; $j < $this->n * 2; $j++) {
for ($i = 0; $i < $this->n; $i++) {
for ($j = $this->n; $j < $this->n * 2; $j++) {
if($j === ($i + $this->n)) {
if ($j === ($i + $this->n)) {
$newMatrixArr[$i][$j] = 1;
} else {
$newMatrixArr[$i][$j] = 0;
@ -219,16 +219,16 @@ class Matrix implements ArrayAccess, Iterator
$newMatrixArr = $this->diag($newMatrixArr);
/* create unit matrix */
for($i = 0; $i < $mDim; $i++) {
for ($i = 0; $i < $mDim; $i++) {
$temp = $newMatrixArr[$i][$i];
for($j = 0; $j < $nDim; $j++) {
for ($j = 0; $j < $nDim; $j++) {
$newMatrixArr[$i][$j] = $newMatrixArr[$i][$j] / $temp;
}
}
/* removing identity matrix */
for($i = 0; $i < $mDim; $i++) {
for ($i = 0; $i < $mDim; $i++) {
$newMatrixArr[$i] = array_slice($newMatrixArr[$i], $mDim);
}
@ -244,7 +244,7 @@ class Matrix implements ArrayAccess, Iterator
$newMatrixArr = $newMatrix->getMatrix();
for ($i = 0; $i < $this->n; $i++) {
for ($j = 0; $j < $i+1; $j++) {
for ($j = 0; $j < $i + 1; $j++) {
$temp = 0;
for ($c = 0; $c < $j; $c++) {
@ -265,23 +265,23 @@ class Matrix implements ArrayAccess, Iterator
$mDim = count($arr);
$nDim = count($arr[0]);
for($i = $mDim - 1; $i > 0; $i--) {
for ($i = $mDim - 1; $i > 0; $i--) {
if ($arr[$i - 1][0] < $arr[$i][0]) {
for($j = 0; $j < $nDim; $j++) {
for ($j = 0; $j < $nDim; $j++) {
$temp = $arr[$i][$j];
$arr[$i][$j] = $arr[$i-1][$j];
$arr[$i-1][$j] = $temp;
$arr[$i][$j] = $arr[$i - 1][$j];
$arr[$i - 1][$j] = $temp;
}
}
}
/* create diagonal matrix */
for($i = 0; $i < $mDim; $i++) {
for($j = 0; $j < $mDim; $j++) {
for ($i = 0; $i < $mDim; $i++) {
for ($j = 0; $j < $mDim; $j++) {
if ($j !== $i) {
$temp = $arr[$j][$i] / $arr[$i][$i];
for($c = 0; $c < $nDim; $c++) {
for ($c = 0; $c < $nDim; $c++) {
$arr[$j][$c] -= $arr[$i][$c] * $temp;
}
}
@ -323,7 +323,7 @@ class Matrix implements ArrayAccess, Iterator
continue;
}
for ($c = $i; $c < $n; $c ++) {
for ($c = $i; $c < $n; $c++) {
$arr[$j][$c] -= $arr[$i][$c] * $r;
}
}

View File

@ -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);

View File

@ -41,7 +41,7 @@ class Prime
*/
public static function isMersenne(int $n) : bool
{
$mersenne = log($n+1, 2);
$mersenne = log($n + 1, 2);
return $mersenne - (int) $mersenne < 0.00001;
}
@ -78,7 +78,7 @@ class Prime
return true;
}
if ($n < 2 || $n % 2 == 0){
if ($n < 2 || $n % 2 == 0) {
return false;
}
@ -91,11 +91,11 @@ class Prime
}
for ($i = 0; $i < $k; $i++) {
$a = mt_rand(2, $n-1);
$a = mt_rand(2, $n - 1);
$x = bcpowmod($a, $d, $n);
if ($x == 1 || $x == $n-1) {
if ($x == 1 || $x == $n - 1) {
continue;
}
@ -106,7 +106,7 @@ class Prime
return false;
}
if ($x == $n-1) {
if ($x == $n - 1) {
continue 2;
}
}

View File

@ -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];

View File

@ -67,7 +67,7 @@ class Graph
*/
public function addVertice(VerticeInterface $vertice) : bool
{
if(!isset($this->vertices[$vertice->getId()])) {
if (!isset($this->vertices[$vertice->getId()])) {
$this->vertices[$vertice->getId()] = $vertice;
return true;
@ -88,7 +88,7 @@ class Graph
*/
public function addEdge(EdgeInterface $edge) : bool
{
if(!isset($this->edges[$edge->getId()])) {
if (!isset($this->edges[$edge->getId()])) {
$this->edges[$edge->getId()] = $edge;
return true;
@ -109,7 +109,7 @@ class Graph
*/
public function removeVertice($id) : bool
{
if(isset($this->vertices[$id])) {
if (isset($this->vertices[$id])) {
unset($this->vertices[$id]);
return true;
@ -146,7 +146,7 @@ class Graph
*/
public function removeEdgeById($id) : bool
{
if(isset($this->edge[$id])) {
if (isset($this->edge[$id])) {
unset($this->edge[$id]);
return true;

View File

@ -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;
}

View File

@ -79,7 +79,7 @@ class Response extends ResponseAbstract implements RenderableInterface
*/
public function pushHeaderId($name)
{
if(self::$isLocked) {
if (self::$isLocked) {
throw new \Exception('Already locked');
}
@ -102,7 +102,7 @@ class Response extends ResponseAbstract implements RenderableInterface
*/
public function removeHeader(int $key) : bool
{
if(self::$isLocked) {
if (self::$isLocked) {
throw new \Exception('Already locked');
}
@ -212,7 +212,7 @@ class Response extends ResponseAbstract implements RenderableInterface
*/
public function pushHeader()
{
if(self::$isLocked) {
if (self::$isLocked) {
throw new \Exception('Already locked');
}
@ -237,7 +237,7 @@ class Response extends ResponseAbstract implements RenderableInterface
*/
public function remove(int $id) : bool
{
if(self::$isLocked) {
if (self::$isLocked) {
throw new \Exception('Already locked');
}
@ -374,7 +374,7 @@ class Response extends ResponseAbstract implements RenderableInterface
*/
public function setHeader($key, string $header, bool $overwrite = false) : bool
{
if(self::$isLocked) {
if (self::$isLocked) {
throw new \Exception('Already locked');
}

View File

@ -50,7 +50,7 @@ class Imap extends Mail
public function getInbox(string $option = 'ALL') : array
{
$ids = imap_search($this->inbox, $option, SE_FREE, 'UTF-8');
$ids = imap_search($this->inbox, $option, SE_FREE, 'UTF-8');
return is_array($ids) ? imap_fetch_overview($this->inbox, implode(',', $ids)) : [];
}

View File

@ -184,7 +184,7 @@ abstract class RequestAbstract implements MessageInterface
*/
public function setRequestSource($source)
{
if(!RequestSource::isValidValue($source)) {
if (!RequestSource::isValidValue($source)) {
throw new InvalidEnumValue($source);
}

View File

@ -81,7 +81,7 @@ class ModuleFactory
self::$loaded[$module] = $obj;
self::registerRequesting($obj);
self::registerProvided($obj);
} catch(\Exception $e) {
} catch (\Exception $e) {
self::$loaded[$module] = new NullModule($app);
}
}

View File

@ -298,7 +298,7 @@ class ModuleManager
$path = realpath($oldPath = self::MODULE_PATH . '/' . $module . '/' . 'info.json');
if($path === false || strpos($path, self::MODULE_PATH) === false) {
if ($path === false || strpos($path, self::MODULE_PATH) === false) {
throw new PathException($module);
}

View File

@ -179,7 +179,7 @@ class Directory extends FileAbstract implements \Iterator, \ArrayAccess
$this->filter = $filter;
parent::__construct($path);
if(file_exists($this->path)) {
if (file_exists($this->path)) {
parent::index();
}
}
@ -242,7 +242,7 @@ class Directory extends FileAbstract implements \Iterator, \ArrayAccess
*/
public function remove(string $name) : bool
{
if(isset($this->nodes[$name])) {
if (isset($this->nodes[$name])) {
$this->count -= $this->nodes[$name]->getCount();
$this->size -= $this->nodes[$name]->getSize();
@ -269,7 +269,7 @@ class Directory extends FileAbstract implements \Iterator, \ArrayAccess
foreach (glob($this->path . DIRECTORY_SEPARATOR . $this->filter) as $filename) {
// todo: handle . and ..???!!!
if(is_dir($filename)) {
if (is_dir($filename)) {
$file = new Directory($filename);
$file->index();
} else {
@ -349,7 +349,7 @@ class Directory extends FileAbstract implements \Iterator, \ArrayAccess
*/
public function offsetUnset($offset)
{
if(isset($this->nodes[$offset])) {
if (isset($this->nodes[$offset])) {
unset($this->nodes[$offset]);
}
}

View File

@ -44,7 +44,7 @@ class File extends FileAbstract
public static function createFile(string $path) : bool
{
if (!file_exists($path)) {
if(is_writable(Directory::getParent($path))) {
if (is_writable(Directory::getParent($path))) {
touch($path);
return true;
@ -69,7 +69,7 @@ class File extends FileAbstract
parent::__construct($path);
$this->count = 1;
if(file_exists($this->path)) {
if (file_exists($this->path)) {
$this->index();
}
}

View File

@ -37,7 +37,7 @@ final class OperatingSystem {
*/
public static function getSystem() : int
{
switch(PHP_OS) {
switch (PHP_OS) {
case stristr(PHP_OS, 'DAR'):
return SystemType::OSX;
case stristr(PHP_OS, 'WIN'):

View File

@ -307,7 +307,7 @@ class Http implements UriInterface
$this->pass = $url['pass'] ?? null;
$this->path = $url['path'] ?? null;
$this->path = rtrim($this->path, '.php');
$this->path = strpos($this->path, $this->rootPath) === 0 ? substr($this->path, strlen($this->rootPath), strlen($this->path)) : $this->path; // TODO: this could cause a bug if the rootpath is the same as a regular path which is usually the language
$this->path = strpos($this->path, $this->rootPath) === 0 ? substr($this->path, strlen($this->rootPath), strlen($this->path)) : $this->path; // TODO: this could cause a bug if the rootpath is the same as a regular path which is usually the language
$this->query = $url['query'] ?? null;
if (isset($this->query)) {

View File

@ -60,7 +60,7 @@ abstract class C128Abstract
* @var string
* @since 1.0.0
*/
protected static $CODE_END = '';
protected static $CODE_END = '';
/**
* Orientation.
@ -76,7 +76,7 @@ abstract class C128Abstract
* @var int
* @since 1.0.0
*/
protected $size = 0;
protected $size = 0;
/**
* Barcode dimension.
@ -86,7 +86,7 @@ abstract class C128Abstract
* @var int[]
* @since 1.0.0
*/
protected $dimension = ['width' => 0, 'height' => 0];
protected $dimension = ['width' => 0, 'height' => 0];
/**
* Content to encrypt.
@ -94,7 +94,7 @@ abstract class C128Abstract
* @var string|int
* @since 1.0.0
*/
protected $content = 0;
protected $content = 0;
/**
* Show text below barcode.
@ -102,7 +102,7 @@ abstract class C128Abstract
* @var string
* @since 1.0.0
*/
protected $showText = true;
protected $showText = true;
/**
* Margin for barcode (padding).
@ -110,7 +110,7 @@ abstract class C128Abstract
* @var int[]
* @since 1.0.0
*/
protected $margin = ['top' => 0, 'right' => 4, 'bottom' => 0, 'left' => 4];
protected $margin = ['top' => 0, 'right' => 4, 'bottom' => 0, 'left' => 4];
/**
* Background color.
@ -118,7 +118,7 @@ abstract class C128Abstract
* @var int[]
* @since 1.0.0
*/
protected $background = ['r' => 0, 'g' => 0, 'b' => 0, 'a' => 0];
protected $background = ['r' => 0, 'g' => 0, 'b' => 0, 'a' => 0];
/**
* Front color.
@ -126,7 +126,7 @@ abstract class C128Abstract
* @var int[]
* @since 1.0.0
*/
protected $front = ['r' => 0, 'g' => 0, 'b' => 0, 'a' => 0];
protected $front = ['r' => 0, 'g' => 0, 'b' => 0, 'a' => 0];
/**
* Constructor

View File

@ -78,7 +78,7 @@ class C25 extends C128Abstract
*/
public function __construct(string $content = '', int $size = 20, int $orientation = OrientationType::HORIZONTAL)
{
if(!ctype_digit($content)) {
if (!ctype_digit($content)) {
throw new \InvalidArgumentException($content);
}
@ -95,7 +95,7 @@ class C25 extends C128Abstract
*/
public function setContent(string $content)
{
if(!ctype_digit($content)) {
if (!ctype_digit($content)) {
throw new \InvalidArgumentException($content);
}

View File

@ -42,7 +42,7 @@ final class Gray {
{
$source = $gray;
while($gray >>= 1) {
while ($gray >>= 1) {
$source ^= $gray;
}

View File

@ -105,7 +105,7 @@ class Commit
$branch = new Branch();
$tag = new Tag();
if(!empty($id)) {
if (!empty($id)) {
// todo: fill base info
}
}
@ -119,7 +119,7 @@ class Commit
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function addFile(string $path) {
if(!isset($this->files[$path])) {
if (!isset($this->files[$path])) {
$this->files[$path] = [];
}
}
@ -203,7 +203,7 @@ class Commit
*/
public function removeFile(string $path) : bool
{
if(isset($this->files[$path])) {
if (isset($this->files[$path])) {
unset($this->files[$path]);
return true;

View File

@ -81,7 +81,7 @@ class Git {
$stdout = stream_get_contents($pipes[1]);
$stderr = stream_get_contents($pipes[2]);
foreach($pipes as $pipe) {
foreach ($pipes as $pipe) {
fclose($pipe);
}

View File

@ -34,7 +34,7 @@ class Repository
* @var string
* @since 1.0.0
*/
private $path = '';
private $path = '';
/**
* Bare repository.
@ -42,7 +42,7 @@ class Repository
* @var bool
* @since 1.0.0
*/
private $bare = false;
private $bare = false;
/**
* Env variables.

View File

@ -31,5 +31,5 @@ use phpOMS\Datatypes\Enum;
abstract class OrderType extends Enum
{
const LOOSE = 0;
const STRICT= 1;
const STRICT = 1;
}

View File

@ -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;
}

View File

@ -13,7 +13,7 @@ class Permutation
if(empty($toPermute)){
$permutations[] = implode('', $result);
}else{
} else{
foreach($toPermute as $key => $val){
$newArr = $toPermute;
$newres = $result;

View File

@ -294,7 +294,7 @@ class Text
*/
public function generateText($length, $words = null)
{
if($length === 0) {
if ($length === 0) {
return '';
}

View File

@ -56,7 +56,7 @@ class SystemUtils
$countSize = 0;
$count = 0;
if(is_readable($dir)) {
if (is_readable($dir)) {
$dir_array = scandir($dir);
foreach ($dir_array as $key => $filename) {

View File

@ -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;
}

View File

@ -75,7 +75,7 @@ abstract class CreditCard extends ValidatorAbstract
public static function luhnTest(string $num) {
$len = strlen($num);
for ($i = $len-1; $i >= 0; $i--) {
for ($i = $len - 1; $i >= 0; $i--) {
$ord = ord($num[$i]);
if (($len - 1) & $i) {