diff --git a/Config/SettingsAbstract.php b/Config/SettingsAbstract.php index a2b144f43..f4a658188 100644 --- a/Config/SettingsAbstract.php +++ b/Config/SettingsAbstract.php @@ -112,7 +112,7 @@ abstract class SettingsAbstract implements OptionsInterface return count($options) > 1 ? $options : reset($options); } catch (\PDOException $e) { $exception = DatabaseExceptionFactory::createException($e); - $message = DatabaseExceptionFactory::createExceptionMessage($e); + $message = DatabaseExceptionFactory::createExceptionMessage($e); throw new $exception($message); } @@ -133,7 +133,7 @@ abstract class SettingsAbstract implements OptionsInterface $this->setOptions($options); if ($store) { - foreach($this->options as $key => $option) { + foreach ($this->options as $key => $option) { $query = new Builder($this->connection); $sql = $query->update($this->connection->prefix . static::$table) ->set([static::$columns[1] => $option]) diff --git a/DataStorage/Database/Connection/ConnectionInterface.php b/DataStorage/Database/Connection/ConnectionInterface.php index d7a0694af..17881ae8d 100644 --- a/DataStorage/Database/Connection/ConnectionInterface.php +++ b/DataStorage/Database/Connection/ConnectionInterface.php @@ -85,5 +85,4 @@ interface ConnectionInterface * @since 1.0.0 */ public function getSchemaGrammar() : SchemaGrammar; - } diff --git a/DataStorage/Database/Connection/SqlServerConnection.php b/DataStorage/Database/Connection/SqlServerConnection.php index f203cbb29..132595ba9 100644 --- a/DataStorage/Database/Connection/SqlServerConnection.php +++ b/DataStorage/Database/Connection/SqlServerConnection.php @@ -72,4 +72,4 @@ class SqlServerConnection extends ConnectionAbstract $this->dbdata['password'] = '****'; } } -} \ No newline at end of file +} diff --git a/DataStorage/Database/DataMapperAbstract.php b/DataStorage/Database/DataMapperAbstract.php index 698ec9394..6c5dfc5fe 100644 --- a/DataStorage/Database/DataMapperAbstract.php +++ b/DataStorage/Database/DataMapperAbstract.php @@ -648,8 +648,8 @@ class DataMapperAbstract implements DataMapperInterface } /** @var string $mapper */ - $mapper = static::$hasMany[$propertyName]['mapper']; - $objsIds = []; + $mapper = static::$hasMany[$propertyName]['mapper']; + $objsIds = []; foreach ($values as $key => &$value) { if (!is_object($value)) { @@ -817,8 +817,7 @@ class DataMapperAbstract implements DataMapperInterface private static function createRelationTable(string $propertyName, array $objsIds, $objId) { /** @var string $table */ - if ( - !empty($objsIds) + if (!empty($objsIds) && static::$hasMany[$propertyName]['table'] !== static::$table && static::$hasMany[$propertyName]['table'] !== static::$hasMany[$propertyName]['mapper']::$table ) { @@ -908,8 +907,8 @@ class DataMapperAbstract implements DataMapperInterface } /** @var string $mapper */ - $mapper = static::$hasMany[$propertyName]['mapper']; - $relReflectionClass = null; + $mapper = static::$hasMany[$propertyName]['mapper']; + $relReflectionClass = null; $objsIds[$propertyName] = []; foreach ($values as $key => &$value) { @@ -1003,8 +1002,7 @@ class DataMapperAbstract implements DataMapperInterface private static function deleteRelationTable(string $propertyName, array $objsIds, $objId) { /** @var string $table */ - if ( - !empty($objsIds) + if (!empty($objsIds) && static::$hasMany[$propertyName]['table'] !== static::$table && static::$hasMany[$propertyName]['table'] !== static::$hasMany[$propertyName]['mapper']::$table ) { @@ -1515,7 +1513,7 @@ class DataMapperAbstract implements DataMapperInterface /** @var string $mapper */ $mapper = static::$hasMany[$member]['mapper']; - $objects = $mapper::getArray($values, RelationType::ALL, $depth); + $objects = $mapper::getArray($values, RelationType::ALL, $depth); $obj[$member] = $objects; } } @@ -1548,13 +1546,13 @@ class DataMapperAbstract implements DataMapperInterface /** @var string $mapper */ $mapper = static::$hasOne[$member]['mapper']; - $id = $reflectionProperty->getValue($obj); + $id = $reflectionProperty->getValue($obj); if (self::isNullObject($id)) { continue; } - $id = is_object($id) ? self::getObjectId($id) : $id; + $id = is_object($id) ? self::getObjectId($id) : $id; $value = self::getInitialized($mapper, $id) ?? $mapper::get($id, RelationType::ALL, null, $depth); $reflectionProperty->setValue($obj, $value); @@ -1582,7 +1580,7 @@ class DataMapperAbstract implements DataMapperInterface { foreach (static::$hasOne as $member => $one) { /** @var string $mapper */ - $mapper = static::$hasOne[$member]['mapper']; + $mapper = static::$hasOne[$member]['mapper']; $obj[$member] = self::getInitialized($mapper, $obj['member']) ?? $mapper::getArray($obj[$member], RelationType::ALL, $depth); } } @@ -1614,13 +1612,13 @@ class DataMapperAbstract implements DataMapperInterface /** @var string $mapper */ $mapper = static::$ownsOne[$member]['mapper']; - $id = $reflectionProperty->getValue($obj); + $id = $reflectionProperty->getValue($obj); if (self::isNullObject($id)) { continue; } - $id = is_object($id) ? self::getObjectId($id) : $id; + $id = is_object($id) ? self::getObjectId($id) : $id; $value = self::getInitialized($mapper, $id) ?? $mapper::get($id, RelationType::ALL, null, $depth); $reflectionProperty->setValue($obj, $value); @@ -1648,7 +1646,7 @@ class DataMapperAbstract implements DataMapperInterface { foreach (static::$ownsOne as $member => $one) { /** @var string $mapper */ - $mapper = static::$ownsOne[$member]['mapper']; + $mapper = static::$ownsOne[$member]['mapper']; $obj[$member] = self::getInitialized($mapper, $obj[$member]) ?? $mapper::getArray($obj[$member], RelationType::ALL, $depth); } } @@ -1680,13 +1678,13 @@ class DataMapperAbstract implements DataMapperInterface /** @var string $mapper */ $mapper = static::$belongsTo[$member]['mapper']; - $id = $reflectionProperty->getValue($obj); + $id = $reflectionProperty->getValue($obj); if (self::isNullObject($id)) { continue; } - $id = is_object($id) ? self::getObjectId($id) : $id; + $id = is_object($id) ? self::getObjectId($id) : $id; $value = self::getInitialized($mapper, $id) ?? $mapper::get($id, RelationType::ALL, null, $depth); $reflectionProperty->setValue($obj, $value); @@ -1714,7 +1712,7 @@ class DataMapperAbstract implements DataMapperInterface { foreach (static::$belongsTo as $member => $one) { /** @var string $mapper */ - $mapper = static::$belongsTo[$member]['mapper']; + $mapper = static::$belongsTo[$member]['mapper']; $obj[$member] = self::getInitialized($mapper, $obj[$member]) ?? $mapper::get($obj[$member], RelationType::ALL, null, $depth); } } @@ -1971,7 +1969,7 @@ class DataMapperAbstract implements DataMapperInterface $toLoad = self::getPrimaryKeysBy($value, self::getColumnByMember($ref)); } - $obj[$value] = self::get($toLoad, $relations, $fill, isset($depth) ? --$depth : null); + $obj[$value] = self::get($toLoad, $relations, $fill, isset($depth) ? --$depth : null); } $countResulsts = count($obj); diff --git a/DataStorage/Database/Exception/InvalidDatabaseTypeException.php b/DataStorage/Database/Exception/InvalidDatabaseTypeException.php index 8f3338823..520cf6743 100644 --- a/DataStorage/Database/Exception/InvalidDatabaseTypeException.php +++ b/DataStorage/Database/Exception/InvalidDatabaseTypeException.php @@ -1,40 +1,40 @@ -specialKeywords as $keyword) { if (strrpos($system, $keyword, -strlen($system)) !== false) { - $prefix = ''; + $prefix = ''; $identifier = ''; } } diff --git a/DataStorage/Database/Query/Builder.php b/DataStorage/Database/Query/Builder.php index 5b62dd355..47adaffbc 100644 --- a/DataStorage/Database/Query/Builder.php +++ b/DataStorage/Database/Query/Builder.php @@ -479,10 +479,10 @@ class Builder extends BuilderAbstract } if (is_string($columns)) { - $columns = [$columns]; + $columns = [$columns]; $operator = [$operator]; - $values = [$values]; - $boolean = [$boolean]; + $values = [$values]; + $boolean = [$boolean]; } $i = 0; diff --git a/DataStorage/Database/Query/Expression.php b/DataStorage/Database/Query/Expression.php index b0db3b14a..c1e114756 100644 --- a/DataStorage/Database/Query/Expression.php +++ b/DataStorage/Database/Query/Expression.php @@ -17,4 +17,4 @@ namespace phpOMS\DataStorage\Database\Query; class Expression { -} \ No newline at end of file +} diff --git a/DataStorage/Database/Schema/QueryType.php b/DataStorage/Database/Schema/QueryType.php index c269cabaf..c0eee8f5a 100644 --- a/DataStorage/Database/Schema/QueryType.php +++ b/DataStorage/Database/Schema/QueryType.php @@ -30,6 +30,6 @@ abstract class QueryType extends Enum { /* public */ const SELECT = 0; /* public */ const CREATE = 1; - /* public */ const DROP = 2; - /* public */ const ALTER = 3; + /* public */ const DROP = 2; + /* public */ const ALTER = 3; } diff --git a/DataStorage/Web/Builder.php b/DataStorage/Web/Builder.php index 9644e1f91..d2989c42a 100644 --- a/DataStorage/Web/Builder.php +++ b/DataStorage/Web/Builder.php @@ -32,7 +32,7 @@ class Builder extends DatabaseQueryBuilder private function download($uri) { $finder = []; - $l11n = new Localization(); + $l11n = new Localization(); foreach ($this->from as $from) { $doc = new \DOMDocument(); @@ -52,7 +52,7 @@ class Builder extends DatabaseQueryBuilder { $finder = $this->download(); $result = []; - $table = null; + $table = null; foreach ($this->wheres as $column => $where) { if ($column === 'xpath') { @@ -86,7 +86,7 @@ class Builder extends DatabaseQueryBuilder private function createTableFromList($node) : array { - $table = []; + $table = []; $children = $node->childNodes; foreach ($children as $child) { diff --git a/Dispatcher/Dispatcher.php b/Dispatcher/Dispatcher.php index b798ee8d2..c0da79424 100644 --- a/Dispatcher/Dispatcher.php +++ b/Dispatcher/Dispatcher.php @@ -198,4 +198,4 @@ class Dispatcher { $this->controllers[$name] = $controller; } -} \ No newline at end of file +} diff --git a/Math/Functions/Fibunacci.php b/Math/Functions/Fibunacci.php index ea8e29b8e..068ddd060 100644 --- a/Math/Functions/Fibunacci.php +++ b/Math/Functions/Fibunacci.php @@ -51,7 +51,7 @@ class Fibunacci * * @since 1.0.0 */ - public static function fibunacci(int $n, int $start = 1) : int + public static function fib(int $n, int $start = 1) : int { if ($n < 3) { return $start; @@ -83,4 +83,4 @@ class Fibunacci { return (int) (((1 + sqrt(5)) ** $n - (1 - sqrt(5)) ** $n) / (2 ** $n * sqrt(5))); } -} \ No newline at end of file +} diff --git a/Math/Geometry/Shape/D2/Polygon.php b/Math/Geometry/Shape/D2/Polygon.php index d99477d74..aaa3696bc 100644 --- a/Math/Geometry/Shape/D2/Polygon.php +++ b/Math/Geometry/Shape/D2/Polygon.php @@ -67,8 +67,9 @@ class Polygon implements D2ShapeInterface */ public function pointInPolygon(array $point) : int { - $coord = $this->coord; + $coord = $this->coord; $coord[] = $this->coord[0]; + return self::isPointInPolygon($point, $coord); } @@ -196,7 +197,7 @@ class Polygon implements D2ShapeInterface */ private function getSignedSurface() : float { - $count = count($this->coord); + $count = count($this->coord); $surface = 0; for ($i = 0; $i < $count - 1; $i++) { @@ -204,7 +205,6 @@ class Polygon implements D2ShapeInterface } $surface += $this->coord[$count - 1]['x'] * $this->coord[0]['y'] - $this->coord[0]['x'] * $this->coord[$count - 1]['y']; - $surface /= 2; return $surface; @@ -219,7 +219,7 @@ class Polygon implements D2ShapeInterface */ public function getPerimeter() : float { - $count = count($this->coord); + $count = count($this->coord); $perimeter = sqrt(($this->coord[0]['x'] - $this->coord[$count - 1]['x']) ** 2 + ($this->coord[0]['y'] - $this->coord[$count - 1]['y']) ** 2); for ($i = 0; $i < $count - 1; $i++) { @@ -239,15 +239,15 @@ class Polygon implements D2ShapeInterface public function getBarycenter() : array { $barycenter = ['x' => 0, 'y' => 0]; - $count = count($this->coord); + $count = count($this->coord); for ($i = 0; $i < $count - 1; $i++) { - $mult = ($this->coord[$i]['x'] * $this->coord[$i + 1]['y'] - $this->coord[$i + 1]['x'] * $this->coord[$i]['y']); + $mult = ($this->coord[$i]['x'] * $this->coord[$i + 1]['y'] - $this->coord[$i + 1]['x'] * $this->coord[$i]['y']); $barycenter['x'] += ($this->coord[$i]['x'] + $this->coord[$i + 1]['x']) * $mult; $barycenter['y'] += ($this->coord[$i]['y'] + $this->coord[$i + 1]['y']) * $mult; } - $mult = ($this->coord[$count - 1]['x'] * $this->coord[0]['y'] - $this->coord[0]['x'] * $this->coord[$count - 1]['y']); + $mult = ($this->coord[$count - 1]['x'] * $this->coord[0]['y'] - $this->coord[0]['x'] * $this->coord[$count - 1]['y']); $barycenter['x'] += ($this->coord[$count - 1]['x'] + $this->coord[0]['x']) * $mult; $barycenter['y'] += ($this->coord[$count - 1]['y'] + $this->coord[0]['y']) * $mult; diff --git a/Math/Geometry/Shape/D3/Prism.php b/Math/Geometry/Shape/D3/Prism.php index 784b71ba7..69c103d78 100644 --- a/Math/Geometry/Shape/D3/Prism.php +++ b/Math/Geometry/Shape/D3/Prism.php @@ -16,4 +16,4 @@ namespace phpOMS\Math\Geometry\Shape\D3; class Prism implements D3ShapeInterface { -} \ No newline at end of file +} diff --git a/Math/Integral/Gauss.php b/Math/Integral/Gauss.php index 2e5f6e095..a2c020d86 100644 --- a/Math/Integral/Gauss.php +++ b/Math/Integral/Gauss.php @@ -17,4 +17,4 @@ namespace phpOMS\Math\Integral; class Gauss { -} \ No newline at end of file +} diff --git a/Math/Matrix/IdentityMatrix.php b/Math/Matrix/IdentityMatrix.php index a15faf484..94b557a1e 100644 --- a/Math/Matrix/IdentityMatrix.php +++ b/Math/Matrix/IdentityMatrix.php @@ -39,4 +39,4 @@ class IdentityMatrix extends Matrix $this->matrix[$i][$i] = 1; } } -} \ No newline at end of file +} diff --git a/Math/Matrix/Matrix.php b/Math/Matrix/Matrix.php index 93664034e..c680ace61 100644 --- a/Math/Matrix/Matrix.php +++ b/Math/Matrix/Matrix.php @@ -181,8 +181,8 @@ class Matrix implements \ArrayAccess, \Iterator */ public function setMatrix(array $matrix) : Matrix { - $this->m = count($matrix); - $this->n = count($matrix[0] ?? 1); + $this->m = count($matrix); + $this->n = count($matrix[0] ?? 1); $this->matrix = $matrix; return $this; @@ -568,30 +568,30 @@ class Matrix implements \ArrayAccess, \Iterator private function gaussElimination($b) : Matrix { - $mDim = count($b); + $mDim = count($b); $matrix = $this->matrix; for ($col = 0; $col < $mDim; $col++) { - $j = $col; + $j = $col; $max = $matrix[$j][$j]; for ($i = $col + 1; $i < $mDim; $i++) { $temp = abs($matrix[$i][$col]); if ($temp > $max) { - $j = $i; + $j = $i; $max = $temp; } } if ($col != $j) { - $temp = $matrix[$col]; + $temp = $matrix[$col]; $matrix[$col] = $matrix[$j]; - $matrix[$j] = $temp; + $matrix[$j] = $temp; - $temp = $b[$col]; + $temp = $b[$col]; $b[$col] = $b[$j]; - $b[$j] = $temp; + $b[$j] = $temp; } for ($i = $col + 1; $i < $mDim; $i++) { @@ -602,7 +602,7 @@ class Matrix implements \ArrayAccess, \Iterator } $matrix[$i][$col] = 0; - $b[$i] -= $temp * $b[$col]; + $b[$i] -= $temp * $b[$col]; } } @@ -752,4 +752,4 @@ class Matrix implements \ArrayAccess, \Iterator $row = (int) ($offset / $this->m); unset($this->matrix[$row][$offset - $row * $this->n]); } -} \ No newline at end of file +} diff --git a/Math/Matrix/QRDecomposition.php b/Math/Matrix/QRDecomposition.php index d7c08bf60..ff4157b66 100644 --- a/Math/Matrix/QRDecomposition.php +++ b/Math/Matrix/QRDecomposition.php @@ -190,4 +190,4 @@ class QRDecomposition return $matrix; } -} \ No newline at end of file +} diff --git a/Math/Matrix/SingularValueDecomposition.php b/Math/Matrix/SingularValueDecomposition.php index da3e72c54..af851b98b 100644 --- a/Math/Matrix/SingularValueDecomposition.php +++ b/Math/Matrix/SingularValueDecomposition.php @@ -16,4 +16,4 @@ namespace phpOMS\Math\Matrix; class SingularValueDecomposition { -} \ No newline at end of file +} diff --git a/Math/Matrix/Vector.php b/Math/Matrix/Vector.php index 4f549df6b..f488779f7 100644 --- a/Math/Matrix/Vector.php +++ b/Math/Matrix/Vector.php @@ -24,15 +24,4 @@ namespace phpOMS\Math\Matrix; */ class Vector extends Matrix { - /** - * Constructor. - * - * @param int $m Columns - * - * @since 1.0.0 - */ - public function __construct(int $m = 1) - { - parent::__construct($m); - } -} \ No newline at end of file +} diff --git a/Math/Number/Integer.php b/Math/Number/Integer.php index d934f8781..1e0eb57b1 100644 --- a/Math/Number/Integer.php +++ b/Math/Number/Integer.php @@ -63,7 +63,7 @@ class Integer while ($value % $prime === 0) { $factors[] = $prime; - $value /= $prime; + $value /= $prime; } } @@ -98,7 +98,7 @@ class Integer } $cycleSize *= 2; - $y = $x; + $y = $x; } return $factor; @@ -160,4 +160,4 @@ class Integer return [(int) round($a - sqrt($b2)), (int) round($a + sqrt($b2))]; } -} \ No newline at end of file +} diff --git a/Math/Number/Natural.php b/Math/Number/Natural.php index 8df495821..c493e273b 100644 --- a/Math/Number/Natural.php +++ b/Math/Number/Natural.php @@ -37,4 +37,4 @@ class Natural { return is_int($value) && $value >= 0; } -} \ No newline at end of file +} diff --git a/Math/Number/NumberType.php b/Math/Number/NumberType.php index 562c2bff5..b37a848d6 100644 --- a/Math/Number/NumberType.php +++ b/Math/Number/NumberType.php @@ -35,4 +35,4 @@ abstract class NumberType extends Enum /* public */ const N_RATIONAL = 32; /* public */ const N_IRRATIONAL = 64; /* public */ const N_COMPLEX = 128; -} \ No newline at end of file +} diff --git a/Math/Optimization/Graph/EdgeInterface.php b/Math/Optimization/Graph/EdgeInterface.php index 748635a10..ac4717a60 100644 --- a/Math/Optimization/Graph/EdgeInterface.php +++ b/Math/Optimization/Graph/EdgeInterface.php @@ -69,4 +69,4 @@ interface EdgeInterface * @since 1.0.0 */ public function setVertices(VerticeInterface $a, VerticeInterface $b); -} \ No newline at end of file +} diff --git a/Math/Optimization/Graph/FloydWarshall.php b/Math/Optimization/Graph/FloydWarshall.php index dd6f641d6..cb9b9db20 100644 --- a/Math/Optimization/Graph/FloydWarshall.php +++ b/Math/Optimization/Graph/FloydWarshall.php @@ -16,4 +16,4 @@ namespace phpOMS\Math\Optimization\Graph; class FloydWarshall { -} \ No newline at end of file +} diff --git a/Message/Http/BrowserType.php b/Message/Http/BrowserType.php index 3b188a4de..933e45f61 100644 --- a/Message/Http/BrowserType.php +++ b/Message/Http/BrowserType.php @@ -28,15 +28,15 @@ use phpOMS\Stdlib\Base\Enum; */ abstract class BrowserType extends Enum { - /* public */ const IE = 'msie'; /* Internet Explorer */ - /* public */ const EDGE = 'edge'; /* Internet Explorer Edge 20+ */ - /* public */ const FIREFOX = 'firefox'; /* Firefox */ - /* public */ const SAFARI = 'safari'; /* Safari */ - /* public */ const CHROME = 'chrome'; /* Chrome */ - /* public */ const OPERA = 'opera'; /* Opera */ - /* public */ const NETSCAPE = 'netscape'; /* Netscape */ - /* public */ const MAXTHON = 'maxthon'; /* Maxthon */ + /* public */ const IE = 'msie'; /* Internet Explorer */ + /* public */ const EDGE = 'edge'; /* Internet Explorer Edge 20+ */ + /* public */ const FIREFOX = 'firefox'; /* Firefox */ + /* public */ const SAFARI = 'safari'; /* Safari */ + /* public */ const CHROME = 'chrome'; /* Chrome */ + /* public */ const OPERA = 'opera'; /* Opera */ + /* public */ const NETSCAPE = 'netscape'; /* Netscape */ + /* public */ const MAXTHON = 'maxthon'; /* Maxthon */ /* public */ const KONQUEROR = 'konqueror'; /* Konqueror */ - /* public */ const HANDHELD = 'mobile'; /* Handheld Browser */ - /* public */ const BLINK = 'blink'; /* Blink Browser */ + /* public */ const HANDHELD = 'mobile'; /* Handheld Browser */ + /* public */ const BLINK = 'blink'; /* Blink Browser */ } diff --git a/Message/Http/Request.php b/Message/Http/Request.php index df36052d3..a0c18c21b 100644 --- a/Message/Http/Request.php +++ b/Message/Http/Request.php @@ -118,9 +118,9 @@ class Request extends RequestAbstract */ private function initCurrentRequest() /* : void */ { - $this->uri = new Http(Http::getCurrent()); - $this->data = $_GET ?? []; - $this->files = $_FILES ?? []; + $this->uri = new Http(Http::getCurrent()); + $this->data = $_GET ?? []; + $this->files = $_FILES ?? []; $this->header->getL11n()->setLanguage($this->loadRequestLanguage()); if (isset($_SERVER['CONTENT_TYPE'])) { @@ -227,7 +227,7 @@ class Request extends RequestAbstract public function createRequestHashs(int $start = 0) /* : void */ { $this->hash = []; - $pathArray = $this->uri->getPathElements(); + $pathArray = $this->uri->getPathElements(); foreach ($pathArray as $key => $path) { $paths = []; @@ -372,8 +372,7 @@ class Request extends RequestAbstract throw new \OutOfRangeException('Value "' . $port . '" is out of range.'); } - return - (!empty($_SERVER['HTTPS'] ?? '') && ($_SERVER['HTTPS'] ?? '') !== 'off') + return (!empty($_SERVER['HTTPS'] ?? '') && ($_SERVER['HTTPS'] ?? '') !== 'off') || (($_SERVER['HTTP_X_FORWARDED_PROTO'] ?? '') === 'https') || (($_SERVER['HTTP_X_FORWARDED_SSL'] ?? '') === 'on') || ($_SERVER['SERVER_PORT'] ?? '') == $port; diff --git a/Message/Mail/EmailAbstract.php b/Message/Mail/EmailAbstract.php index 5d596b181..0f3a59e9d 100644 --- a/Message/Mail/EmailAbstract.php +++ b/Message/Mail/EmailAbstract.php @@ -76,10 +76,10 @@ class EmailAbstract */ public function __construct(string $host = 'localhost', int $port = 25, int $timeout = 30, bool $ssl = false) { - $this->host = $host; - $this->port = $port; + $this->host = $host; + $this->port = $port; $this->timeout = $timeout; - $this->ssl = $ssl; + $this->ssl = $ssl; imap_timeout(IMAP_OPENTIMEOUT, $timeout); imap_timeout(IMAP_READTIMEOUT, $timeout); @@ -488,7 +488,7 @@ class EmailAbstract public function getMessageOverview(int $length = 0, int $start = 1) : array { if ($length === 0) { - $info = imap_check($this->con); + $info = imap_check($this->con); $length = $info->Nmsgs; } diff --git a/Message/RequestSource.php b/Message/RequestSource.php index fd7c3e99f..a32d3a1b8 100644 --- a/Message/RequestSource.php +++ b/Message/RequestSource.php @@ -26,8 +26,8 @@ use phpOMS\Stdlib\Base\Enum; */ abstract class RequestSource extends Enum { - /* public */ const WEB = 0; /* This is a http request */ - /* public */ const CONSOLE = 1; /* Request is a console command */ - /* public */ const SOCKET = 2; /* Request through socket connection */ - /* public */ const UNDEFINED = 3; /* Request through socket connection */ + /* public */ const WEB = 0; /* This is a http request */ + /* public */ const CONSOLE = 1; /* Request is a console command */ + /* public */ const SOCKET = 2; /* Request through socket connection */ + /* public */ const UNDEFINED = 3; } diff --git a/Message/ResponseType.php b/Message/ResponseType.php index 85cfea215..cf31a6d8d 100644 --- a/Message/ResponseType.php +++ b/Message/ResponseType.php @@ -26,7 +26,7 @@ use phpOMS\Stdlib\Base\Enum; */ abstract class ResponseType extends Enum { - /* public */ const HTTP = 0; /* HTTP */ - /* public */ const SOCKET = 1; /* Socket */ + /* public */ const HTTP = 0; /* HTTP */ + /* public */ const SOCKET = 1; /* Socket */ /* public */ const CONSOLE = 2; /* Console */ } diff --git a/Model/Html/Head.php b/Model/Html/Head.php index 691a60301..a71212288 100644 --- a/Model/Html/Head.php +++ b/Model/Html/Head.php @@ -185,7 +185,7 @@ class Head implements RenderableInterface */ public function render() : string { - $head = ''; + $head = ''; $head .= $this->meta->render(); $head .= $this->renderStyle(); $head .= $this->renderScript(); diff --git a/Module/ModuleManager.php b/Module/ModuleManager.php index 94a25fe9f..c13915ac3 100644 --- a/Module/ModuleManager.php +++ b/Module/ModuleManager.php @@ -102,7 +102,7 @@ class ModuleManager */ public function __construct(ApplicationAbstract $app, string $modulePath = '') { - $this->app = $app; + $this->app = $app; $this->modulePath = $modulePath; } @@ -435,7 +435,7 @@ class ModuleManager */ public function reInit(string $module) /* : void */ { - $info = $this->loadInfo($module); + $info = $this->loadInfo($module); $class = '\\Modules\\' . $info->getDirectory() . '\\Admin\\Installer'; if (!Autoloader::exists($class)) { diff --git a/Module/ModuleStatus.php b/Module/ModuleStatus.php index bf41eb54e..b9cb9f600 100644 --- a/Module/ModuleStatus.php +++ b/Module/ModuleStatus.php @@ -25,6 +25,6 @@ use phpOMS\Stdlib\Base\Enum; */ abstract class ModuleStatus extends Enum { - /* public */ const ACTIVE = 1; + /* public */ const ACTIVE = 1; /* public */ const INACTIVE = 2; } diff --git a/Router/RouteVerb.php b/Router/RouteVerb.php index cc2c2e2a4..e73766d1b 100644 --- a/Router/RouteVerb.php +++ b/Router/RouteVerb.php @@ -26,9 +26,9 @@ use phpOMS\Stdlib\Base\Enum; */ abstract class RouteVerb extends Enum { - /* public */ const GET = 1; - /* public */ const PUT = 2; - /* public */ const SET = 4; + /* public */ const GET = 1; + /* public */ const PUT = 2; + /* public */ const SET = 4; /* public */ const DELETE = 8; - /* public */ const ANY = 16; + /* public */ const ANY = 16; } diff --git a/Security/PhpCode.php b/Security/PhpCode.php index a0d2c114d..9a829a532 100644 --- a/Security/PhpCode.php +++ b/Security/PhpCode.php @@ -1,78 +1,78 @@ -parse($serialized); } -} \ No newline at end of file +} diff --git a/Stdlib/Base/PhoneType.php b/Stdlib/Base/PhoneType.php index 7087498a5..5f527e84b 100644 --- a/Stdlib/Base/PhoneType.php +++ b/Stdlib/Base/PhoneType.php @@ -24,8 +24,8 @@ namespace phpOMS\Stdlib\Base; */ abstract class PhoneType extends Enum { - /* public */ const HOME = 1; + /* public */ const HOME = 1; /* public */ const BUSINESS = 2; - /* public */ const MOBILE = 3; - /* public */ const WORK = 4; + /* public */ const MOBILE = 3; + /* public */ const WORK = 4; } diff --git a/Stdlib/Base/SmartDateTime.php b/Stdlib/Base/SmartDateTime.php index fa58ec43c..755f0179d 100644 --- a/Stdlib/Base/SmartDateTime.php +++ b/Stdlib/Base/SmartDateTime.php @@ -44,14 +44,6 @@ class SmartDateTime extends \DateTime */ /* public */ const TIMEZONE = 'UTC'; - /** - * {@inheritdoc} - */ - public function __construct($time = 'now', $timezone = null) - { - parent::__construct($time, $timezone); - } - /** * Create object from DateTime * @@ -264,7 +256,7 @@ class SmartDateTime extends \DateTime $diffToWeekStart = $diffToWeekStart === 0 ? 7 : $diffToWeekStart; // get days of previous month - $previousMonth = $this->createModify(0, -1); + $previousMonth = $this->createModify(0, -1); $daysPreviousMonth = $previousMonth->getDaysOfMonth(); // add difference to $weekStartsWith counting backwards from days of previous month (reorder so that lowest value first) @@ -280,7 +272,8 @@ class SmartDateTime extends \DateTime // add remaining days to next month (7*6 - difference+count of current month) $remainingDays = 42 - $diffToWeekStart - $daysMonth; - $nextMonth = $this->createModify(0, 1); + $nextMonth = $this->createModify(0, 1); + for ($i = 1; $i <= $remainingDays; $i++) { $days[] = new \DateTime($nextMonth->format('Y') . '-' . $nextMonth->format('m') . '-' . ($i)); } diff --git a/Stdlib/Graph/Edge.php b/Stdlib/Graph/Edge.php index 8b56b4537..74377b8c3 100644 --- a/Stdlib/Graph/Edge.php +++ b/Stdlib/Graph/Edge.php @@ -32,8 +32,8 @@ class Edge public function __construct(Node $node1, Node $node2, bool $directed = false) { - $this->node1 = $node1; - $this->node2 = $node2; + $this->node1 = $node1; + $this->node2 = $node2; $this->directed = $directed; } @@ -46,4 +46,4 @@ class Edge { return $this->directed; } -} \ No newline at end of file +} diff --git a/Stdlib/Graph/Graph.php b/Stdlib/Graph/Graph.php index f9dbd0ae0..4746620ad 100644 --- a/Stdlib/Graph/Graph.php +++ b/Stdlib/Graph/Graph.php @@ -461,4 +461,4 @@ class Graph // todo: implement return true; } -} \ No newline at end of file +} diff --git a/Stdlib/Graph/Node.php b/Stdlib/Graph/Node.php index 48b74d05f..33ef1f46b 100644 --- a/Stdlib/Graph/Node.php +++ b/Stdlib/Graph/Node.php @@ -26,4 +26,4 @@ namespace phpOMS\Stdlib\Graph; */ class Node { -} \ No newline at end of file +} diff --git a/Stdlib/Map/KeyType.php b/Stdlib/Map/KeyType.php index d694bf887..246888cf4 100644 --- a/Stdlib/Map/KeyType.php +++ b/Stdlib/Map/KeyType.php @@ -26,6 +26,6 @@ use phpOMS\Stdlib\Base\Enum; */ abstract class KeyType extends Enum { - /* public */ const SINGLE = 0; + /* public */ const SINGLE = 0; /* public */ const MULTIPLE = 1; } diff --git a/Stdlib/Map/MultiMap.php b/Stdlib/Map/MultiMap.php index 85173775a..5477d02dc 100644 --- a/Stdlib/Map/MultiMap.php +++ b/Stdlib/Map/MultiMap.php @@ -298,7 +298,7 @@ class MultiMap implements \Countable return $this->remove(implode(':', $key)); } - $keys = Permutation::permut($key); + $keys = Permutation::permut($key); $found = true; foreach ($keys as $key => $value) { diff --git a/Stdlib/Map/OrderType.php b/Stdlib/Map/OrderType.php index 6f60a3b29..e50cb596a 100644 --- a/Stdlib/Map/OrderType.php +++ b/Stdlib/Map/OrderType.php @@ -26,6 +26,6 @@ use phpOMS\Stdlib\Base\Enum; */ abstract class OrderType extends Enum { - /* public */ const LOOSE = 0; + /* public */ const LOOSE = 0; /* public */ const STRICT = 1; } diff --git a/Stdlib/Queue/PriorityMode.php b/Stdlib/Queue/PriorityMode.php index 0ccc99c64..5ca9fac6d 100644 --- a/Stdlib/Queue/PriorityMode.php +++ b/Stdlib/Queue/PriorityMode.php @@ -26,10 +26,10 @@ use phpOMS\Stdlib\Base\Enum; */ abstract class PriorityMode extends Enum { - /* public */ const FIFO = 1; - /* public */ const LIFO = 2; + /* public */ const FIFO = 1; + /* public */ const LIFO = 2; /* public */ const EARLIEST_DEADLINE = 4; - /* public */ const SHORTEST_JOB = 8; - /* public */ const HIGHEST = 16; - /* public */ const LOWEST = 32; + /* public */ const SHORTEST_JOB = 8; + /* public */ const HIGHEST = 16; + /* public */ const LOWEST = 32; } diff --git a/System/File/ContentPutMode.php b/System/File/ContentPutMode.php index 1c464c0d4..21adfb3cc 100644 --- a/System/File/ContentPutMode.php +++ b/System/File/ContentPutMode.php @@ -32,4 +32,4 @@ abstract class ContentPutMode extends Enum /* public */ const PREPEND = 2; /* public */ const REPLACE = 4; /* public */ const CREATE = 8; -} \ No newline at end of file +} diff --git a/System/File/ExtensionType.php b/System/File/ExtensionType.php index 55a47fd5d..36dac82b8 100644 --- a/System/File/ExtensionType.php +++ b/System/File/ExtensionType.php @@ -38,4 +38,4 @@ abstract class ExtensionType extends Enum /* public */ const ARCHIVE = 128; /* public */ const PRESENTATION = 256; /* public */ const IMAGE = 512; -} \ No newline at end of file +} diff --git a/System/File/FileUtils.php b/System/File/FileUtils.php index 6ec2a6556..07116bd34 100644 --- a/System/File/FileUtils.php +++ b/System/File/FileUtils.php @@ -95,7 +95,7 @@ class FileUtils if (!file_exists($origPath)) { $startsWithSlash = strpos($origPath, '/') === 0 ? '/' : ''; - $path = []; + $path = []; $parts = explode('/', $origPath); foreach ($parts as $part) { @@ -117,4 +117,4 @@ class FileUtils return realpath($origPath); } -} \ No newline at end of file +} diff --git a/System/File/Ftp/Directory.php b/System/File/Ftp/Directory.php index 02787a9cc..4ba9e45cb 100644 --- a/System/File/Ftp/Directory.php +++ b/System/File/Ftp/Directory.php @@ -214,8 +214,8 @@ class Directory extends FileAbstract implements DirectoryInterface public function addNode($file) : bool { - $this->count += $file->getCount(); - $this->size += $file->getSize(); + $this->count += $file->getCount(); + $this->size += $file->getSize(); $this->nodes[$file->getName()] = $file; return $file->createNode(); @@ -338,4 +338,4 @@ class Directory extends FileAbstract implements DirectoryInterface { // TODO: Implement offsetGet() method. } -} \ No newline at end of file +} diff --git a/System/File/Ftp/File.php b/System/File/Ftp/File.php index ec0c55a91..259f265fe 100644 --- a/System/File/Ftp/File.php +++ b/System/File/Ftp/File.php @@ -83,7 +83,7 @@ class File extends FileAbstract implements FileInterface public static function put(string $path, string $content, int $mode = ContentPutMode::REPLACE | ContentPutMode::CREATE) : bool { $http = new Http($path); - $con = self::ftpConnect($http); + $con = self::ftpConnect($http); if (ftp_pwd($con) !== $http->getPath()) { return false; @@ -561,4 +561,4 @@ class File extends FileAbstract implements FileInterface { // TODO: Implement getExtension() method. } -} \ No newline at end of file +} diff --git a/System/File/Ftp/FtpStorage.php b/System/File/Ftp/FtpStorage.php index 0a8901cd8..f94ea4240 100644 --- a/System/File/Ftp/FtpStorage.php +++ b/System/File/Ftp/FtpStorage.php @@ -32,7 +32,8 @@ class FtpStorage extends StorageAbstract { private static $instance = null; - public function __construct() { + public function __construct() + { } @@ -141,4 +142,4 @@ class FtpStorage extends StorageAbstract return File::extension($path); } -} \ No newline at end of file +} diff --git a/System/File/Local/LocalStorage.php b/System/File/Local/LocalStorage.php index b98790901..4f3e2e4c8 100644 --- a/System/File/Local/LocalStorage.php +++ b/System/File/Local/LocalStorage.php @@ -13,6 +13,7 @@ declare(strict_types = 1); namespace phpOMS\System\File\Local; + use phpOMS\System\File\StorageAbstract; use phpOMS\System\File\PathException; @@ -166,4 +167,4 @@ class LocalStorage extends StorageAbstract return File::extension($path); } -} \ No newline at end of file +} diff --git a/Utils/Barcode/C128Abstract.php b/Utils/Barcode/C128Abstract.php index 5cbdacb1d..c77afc5e4 100644 --- a/Utils/Barcode/C128Abstract.php +++ b/Utils/Barcode/C128Abstract.php @@ -278,9 +278,9 @@ abstract class C128Abstract $checksum = static::$CHECKSUM; for ($pos = 1; $pos <= $length; $pos++) { - $activeKey = substr($this->content, ($pos - 1), 1); + $activeKey = substr($this->content, ($pos - 1), 1); $codeString .= static::$CODEARRAY[$activeKey]; - $checksum += $values[$activeKey] * $pos; + $checksum += $values[$activeKey] * $pos; } $codeString .= static::$CODEARRAY[$keys[($checksum - (intval($checksum / 103) * 103))]]; @@ -348,7 +348,9 @@ abstract class C128Abstract private function calculateCodeLength(string $codeString) : int { $codeLength = 0; - for ($i = 1; $i <= strlen($codeString); $i++) { + $length = strlen($codeString); + + for ($i = 1; $i <= $length; $i++) { $codeLength = $codeLength + (int) (substr($codeString, ($i - 1), 1)); } diff --git a/Utils/Barcode/C39.php b/Utils/Barcode/C39.php index 774f46f12..2bb44c75a 100644 --- a/Utils/Barcode/C39.php +++ b/Utils/Barcode/C39.php @@ -61,23 +61,6 @@ class C39 extends C128Abstract */ protected static $CODE_END = '121121211'; - /** - * Constructor - * - * @param string $content Content to encrypt - * @param int $width Barcode width - * @param int $height Barcode height - * @param int $orientation Orientation of the barcode - * - * @todo : add mirror parameter - * - * @since 1.0.0 - */ - public function __construct(string $content = '', int $width = 100, int $height = 20, int $orientation = OrientationType::HORIZONTAL) - { - parent::__construct($content, $width, $height, $orientation); - } - /** * Set content to encrypt * diff --git a/tests/Business/Finance/FinanceFormulasTest.php b/tests/Business/Finance/FinanceFormulasTest.php index dedfadbb4..2af546db6 100644 --- a/tests/Business/Finance/FinanceFormulasTest.php +++ b/tests/Business/Finance/FinanceFormulasTest.php @@ -238,7 +238,7 @@ class FinanceFormulasTest extends \PHPUnit\Framework\TestCase public function testDiscountedPaybackPeriod() { $O1 = 5000; - $r = 0.05; + $r = 0.05; $CF = 1000; self::assertTrue(abs(5.896 - FinanceFormulas::getDiscountedPaybackPeriod($CF, $O1, $r)) < 0.01); diff --git a/tests/Math/Functions/FibunacciTest.php b/tests/Math/Functions/FibunacciTest.php index 4e0ee4699..c8f7254c5 100644 --- a/tests/Math/Functions/FibunacciTest.php +++ b/tests/Math/Functions/FibunacciTest.php @@ -25,11 +25,11 @@ class FibunacciTest extends \PHPUnit\Framework\TestCase self::assertFalse(Fibunacci::isFibunacci(6)); self::assertFalse(Fibunacci::isFibunacci(87)); - self::assertEquals(1, Fibunacci::fibunacci(1)); + self::assertEquals(1, Fibunacci::fib(1)); self::assertTrue(Fibunacci::isFibunacci(Fibunacci::binet(3))); self::assertTrue(Fibunacci::isFibunacci(Fibunacci::binet(6))); - self::assertEquals(Fibunacci::binet(6), Fibunacci::fibunacci(6)); - self::assertEquals(Fibunacci::binet(8), Fibunacci::fibunacci(8)); + self::assertEquals(Fibunacci::binet(6), Fibunacci::fib(6)); + self::assertEquals(Fibunacci::binet(8), Fibunacci::fib(8)); } } diff --git a/tests/Utils/Compression/LZWTest.php b/tests/Utils/Compression/LZWTest.php index 9c513ecf8..665670dff 100644 --- a/tests/Utils/Compression/LZWTest.php +++ b/tests/Utils/Compression/LZWTest.php @@ -19,7 +19,7 @@ class LZWTest extends \PHPUnit\Framework\TestCase { public function testLZW() { - $expected = 'This is a test'; + $expected = 'This is a test'; $compression = new LZW(); self::assertEquals($expected, $compression->decompress($compression->compress($expected))); } diff --git a/tests/Utils/TaskSchedule/SchedulerAbstractTest.php b/tests/Utils/TaskSchedule/SchedulerAbstractTest.php index 29bd34157..4b2b2e8ee 100644 --- a/tests/Utils/TaskSchedule/SchedulerAbstractTest.php +++ b/tests/Utils/TaskSchedule/SchedulerAbstractTest.php @@ -21,4 +21,4 @@ class SchedulerAbstractTest extends \PHPUnit\Framework\TestCase { self::assertEquals('', SchedulerAbstract::getBin()); } -} \ No newline at end of file +}