diff --git a/DataStorage/Database/DataMapperAbstract.php b/DataStorage/Database/DataMapperAbstract.php index d029347c7..603f121ba 100644 --- a/DataStorage/Database/DataMapperAbstract.php +++ b/DataStorage/Database/DataMapperAbstract.php @@ -550,6 +550,7 @@ abstract class DataMapperAbstract implements DataMapperInterface * Populate data. * * @param array $result Result set + * @param mixed $obj Object to populate * * @return mixed * @@ -597,7 +598,7 @@ abstract class DataMapperAbstract implements DataMapperInterface $reflectionProperty = $reflectionClass->getProperty($member); $mapper = new $rel['mapper']($this->db); - $mapper->get($reflectionProperty->getValue($obj, $member), $relations, $obj); + $mapper->get($reflectionProperty->getValue($obj), $relations, $obj); } } @@ -773,6 +774,8 @@ abstract class DataMapperAbstract implements DataMapperInterface /** * Get object. * + * @param int $relations Load relations + * * @return array * * @since 1.0.0 @@ -812,6 +815,7 @@ abstract class DataMapperAbstract implements DataMapperInterface * * @param int $limit Newest limit * @param Builder $query Pre-defined query + * @param int $relations Load relations * * @return mixed * @@ -917,7 +921,7 @@ abstract class DataMapperAbstract implements DataMapperInterface } /* loading relations from relations table and populating them and then adding them to the object */ - if ($relations !== RealtionType::NONE) { + if ($relations !== RelationType::NONE) { if ($hasMany) { $this->populateManyToMany($this->getManyRaw($key, $relations), $obj[$key]); } @@ -985,6 +989,7 @@ abstract class DataMapperAbstract implements DataMapperInterface * Get raw by primary key * * @param mixed $primaryKey Primary key + * @param int $relations Load relations * * @return array * diff --git a/DataStorage/Database/Query/Builder.php b/DataStorage/Database/Query/Builder.php index 3107c6d15..9e61fa8a7 100644 --- a/DataStorage/Database/Query/Builder.php +++ b/DataStorage/Database/Query/Builder.php @@ -265,7 +265,7 @@ class Builder extends BuilderAbstract /** * Creating new. * - * @return self + * @return Builder * * @since 1.0.0 * @author Dennis Eichhorn @@ -718,6 +718,7 @@ class Builder extends BuilderAbstract * Values to insert. * * @param mixed $value Values + * @param string $type Data type to insert * * @return Builder * diff --git a/DataStorage/Session/ConsoleSession.php b/DataStorage/Session/ConsoleSession.php index 39a143315..088e25b82 100644 --- a/DataStorage/Session/ConsoleSession.php +++ b/DataStorage/Session/ConsoleSession.php @@ -40,7 +40,7 @@ class ConsoleSession implements SessionInterface /** * Constructor. * - * @param string|int $sid Session id + * @param string|int|bool $sid Session id * * @since 1.0.0 * @author Dennis Eichhorn diff --git a/DataStorage/Session/SocketSession.php b/DataStorage/Session/SocketSession.php index 7cd1ea246..0ae50a265 100644 --- a/DataStorage/Session/SocketSession.php +++ b/DataStorage/Session/SocketSession.php @@ -40,7 +40,7 @@ class SocketSession implements SessionInterface /** * Constructor. * - * @param string|int $sid Session id + * @param string|int|bool $sid Session id * * @since 1.0.0 * @author Dennis Eichhorn diff --git a/Math/Function/Functions.php b/Math/Function/Functions.php index d61386be4..4d1d6262a 100644 --- a/Math/Function/Functions.php +++ b/Math/Function/Functions.php @@ -135,7 +135,7 @@ class Functions return self::ackermann($m - 1, 1); } - return ackermann($m - 1, ackermann($m, $n - 1)); + return self::ackermann($m - 1, self::ackermann($m, $n - 1)); } /** diff --git a/Math/Matrix/Matrix.php b/Math/Matrix/Matrix.php index ce9c379cc..2d4322937 100644 --- a/Math/Matrix/Matrix.php +++ b/Math/Matrix/Matrix.php @@ -2,12 +2,12 @@ namespace phpOMS\Math\Matrix; -class Matrix implements ArrayAccess, Iterator +class Matrix implements \ArrayAccess, \Iterator { - private $matrix = []; + protected $matrix = []; - private $n = 0; - private $m = 0; + protected $n = 0; + protected $m = 0; public function __construct(int $m, int $n = 1) { @@ -46,7 +46,7 @@ class Matrix implements ArrayAccess, Iterator public function transpose() : Matrix { $matrix = new Matrix($this->n, $this->m); - $matrix->setMatrix(array_map(null, ...$matrix)); + $matrix->setMatrix(array_map(null, $matrix->getMatrix())); return $matrix; } @@ -58,6 +58,8 @@ class Matrix implements ArrayAccess, Iterator } elseif (is_scalar($value)) { return $this->multScalar($value); } + + throw new \Exception(); } private function multMatrix(Matrix $matrix) : Matrix @@ -113,15 +115,19 @@ class Matrix implements ArrayAccess, Iterator } elseif (is_scalar($value)) { return $this->addScalar($value); } + + throw new \Exception(); } public function sub($value) : Matrix { if ($value instanceOf Matrix) { - return $this->add($this->multMatrix(-1)); + return $this->add($this->mult(-1)); } elseif (is_scalar($value)) { - return $this->addScalar(-$value); + return $this->add(-$value); } + + throw new \Exception(); } private function addMatrix(Matrix $value) : Matrix @@ -177,11 +183,6 @@ class Matrix implements ArrayAccess, Iterator return new Matrix($this->m, $this->n); } - public function diag() : Matrix - { - - } - public function inverse(int $algorithm = InversionType::GAUSS_JORDAN) : Matrix { if ($this->n !== $this->m) { diff --git a/Math/Number/Integer.php b/Math/Number/Integer.php index 594d1ad99..c96b513d3 100644 --- a/Math/Number/Integer.php +++ b/Math/Number/Integer.php @@ -1,5 +1,7 @@ $value) { break; } diff --git a/Math/Optimization/Graph/Graph.php b/Math/Optimization/Graph/Graph.php index d088b188a..8ae492fea 100644 --- a/Math/Optimization/Graph/Graph.php +++ b/Math/Optimization/Graph/Graph.php @@ -14,6 +14,9 @@ * @link http://orange-management.com */ namespace phpOMS\Math\Optimization\Graph; +use phpOMS\Stdlib\Map\KeyType; +use phpOMS\Stdlib\Map\MultiMap; +use phpOMS\Stdlib\Map\OrderType; /** * Graph class @@ -124,7 +127,7 @@ class Graph * @param mixed $a First node of edge * @param mixed $b Second node of edge * - * @return EdgeInterface + * @return bool * * @since 1.0.0 * @author Dennis Eichhorn @@ -191,7 +194,7 @@ class Graph /** * Get edge by id. * - * @param itn $id Edge id + * @param int $id Edge id * * @return EdgeInterface * diff --git a/Message/Http/Request.php b/Message/Http/Request.php index 2f36c20d9..8b5d24c68 100644 --- a/Message/Http/Request.php +++ b/Message/Http/Request.php @@ -446,6 +446,8 @@ class Request extends RequestAbstract * * @return int * + * @throws \Exception + * * @since 1.0.0 * @author Dennis Eichhorn */ diff --git a/Message/Http/Rest.php b/Message/Http/Rest.php index 39210d4c3..48164ad77 100644 --- a/Message/Http/Rest.php +++ b/Message/Http/Rest.php @@ -15,8 +15,6 @@ */ namespace phpOMS\Message\Http; -use phpOMS\Message\Http\RequestMethod; - /** * Rest request class. * diff --git a/Module/ActivateAbstract.php b/Module/ActivateAbstract.php index 4da91c9f8..dc4d7b1e6 100644 --- a/Module/ActivateAbstract.php +++ b/Module/ActivateAbstract.php @@ -35,14 +35,14 @@ class ActivateAbstract * Install module. * * @param Pool $dbPool Database instance - * @param array $info Module info + * @param InfoManager $info Module info * * @return void * * @since 1.0.0 * @author Dennis Eichhorn */ - public static function activate(Pool $dbPool, array $info) + public static function activate(Pool $dbPool, InfoManager $info) { } } diff --git a/Module/DeactivateAbstract.php b/Module/DeactivateAbstract.php index 2bff47a5b..9504064a1 100644 --- a/Module/DeactivateAbstract.php +++ b/Module/DeactivateAbstract.php @@ -35,14 +35,14 @@ class DeactivateAbstract * Install module. * * @param Pool $dbPool Database instance - * @param array $info Module info + * @param InfoManager $info Module info * * @return void * * @since 1.0.0 * @author Dennis Eichhorn */ - public static function deactivate(Pool $dbPool, array $info) + public static function deactivate(Pool $dbPool, InfoManager $info) { } } diff --git a/Module/InstallerAbstract.php b/Module/InstallerAbstract.php index 367334ffd..e611c5108 100644 --- a/Module/InstallerAbstract.php +++ b/Module/InstallerAbstract.php @@ -16,8 +16,7 @@ namespace phpOMS\Module; use phpOMS\DataStorage\Database\Pool; -use phpOMS\Module\InfoManager; -use phpOMS\Router\RouteVerb; +use phpOMS\System\File\PermissionException; use phpOMS\Utils\Parser\Php\ArrayParser; /** @@ -38,7 +37,7 @@ class InstallerAbstract * Install module. * * @param Pool $dbPool Database instance - * @param array $info Module info + * @param InfoManager $info Module info * * @return void * @@ -60,13 +59,17 @@ class InstallerAbstract * * @return void * + * @throws PermissionException + * * @since 1.0.0 * @author Dennis Eichhorn */ private static function installRoutes(string $destRoutePath, string $srcRoutePath) { if(file_exists($destRoutePath) && file_exists($srcRoutePath)) { + /** @noinspection PhpIncludeInspection */ $appRoutes = include $destRoutePath; + /** @noinspection PhpIncludeInspection */ $moduleRoutes = include $srcRoutePath; $appRoutes = array_merge_recursive($appRoutes, $moduleRoutes); diff --git a/Module/UninstallAbstract.php b/Module/UninstallAbstract.php index 9da0da83d..bd3901a16 100644 --- a/Module/UninstallAbstract.php +++ b/Module/UninstallAbstract.php @@ -35,7 +35,7 @@ class UninstallAbstract * Install module. * * @param Pool $dbPool Database instance - * @param array $info Module info + * @param InfoManager $info Module info * * @return void * diff --git a/Module/UpdateAbstract.php b/Module/UpdateAbstract.php index 30b90cdd4..dac0c65a3 100644 --- a/Module/UpdateAbstract.php +++ b/Module/UpdateAbstract.php @@ -35,14 +35,14 @@ class UpdateAbstract * Install module. * * @param Pool $dbPool Database instance - * @param array $info Module info + * @param InfoManager $info Module info * * @return void * * @since 1.0.0 * @author Dennis Eichhorn */ - public static function update(Pool $dbPool, array $info) + public static function update(Pool $dbPool, InfoManager $info) { } } diff --git a/Security/Encryption/Encryption.php b/Security/Encryption/Encryption.php index cd95984ee..d55c6c7ec 100644 --- a/Security/Encryption/Encryption.php +++ b/Security/Encryption/Encryption.php @@ -417,6 +417,8 @@ class Encryption * * @return string * + * @throws \Exception + * * @since 1.0.0 * @author Dennis Eichhorn */ diff --git a/System/File/Directory.php b/System/File/Directory.php index 3925765ae..cf6d33814 100644 --- a/System/File/Directory.php +++ b/System/File/Directory.php @@ -225,12 +225,14 @@ class Directory extends FileAbstract implements \Iterator, \ArrayAccess * * @param string $name File/direcotry name * + * @return FileAbstract + * * @since 1.0.0 * @author Dennis Eichhorn */ public function get(string $name) : FileAbstract { - return $this->nodes[$name] ?? new NullFile(); + return $this->nodes[$name] ?? new NullFile(''); } /** @@ -238,6 +240,8 @@ class Directory extends FileAbstract implements \Iterator, \ArrayAccess * * @param FileAbstract $file File to add * + * @return bool + * * @since 1.0.0 * @author Dennis Eichhorn */ diff --git a/System/File/File.php b/System/File/File.php index 8abe87d9e..58effcf07 100644 --- a/System/File/File.php +++ b/System/File/File.php @@ -79,7 +79,7 @@ class File extends FileAbstract */ public function createNode() : bool { - return self::create($this->path); + return self::createFile($this->path); } /** diff --git a/Utils/ArrayUtils.php b/Utils/ArrayUtils.php index c3c719188..375ad2527 100644 --- a/Utils/ArrayUtils.php +++ b/Utils/ArrayUtils.php @@ -208,6 +208,7 @@ class ArrayUtils public static function arrayToCSV(array $data, string $delimiter = ';', string $enclosure = '"', string $escape = '\\') : string { $outstream = fopen('php://memory', 'r+'); + /** @noinspection PhpMethodParametersCountMismatchInspection */ fputcsv($outstream, $data, $delimiter, $enclosure, $escape); rewind($outstream); $csv = fgets($outstream); diff --git a/Utils/Barcode/Aztec.php b/Utils/Barcode/Aztec.php index 22520cb5b..8b977c733 100644 --- a/Utils/Barcode/Aztec.php +++ b/Utils/Barcode/Aztec.php @@ -18,7 +18,7 @@ class Aztec } - private function arrange() { + private function arange() { } } diff --git a/Utils/Git/Commit.php b/Utils/Git/Commit.php index 35134935f..853a5bb3c 100644 --- a/Utils/Git/Commit.php +++ b/Utils/Git/Commit.php @@ -14,6 +14,7 @@ * @link http://orange-management.com */ namespace phpOMS\Utils\Git; +use phpDocumentor\Reflection\DocBlock\Tag; /** * Gray encoding class @@ -153,7 +154,7 @@ class Commit /** * Set commit message. * - * @param string $path File path + * @param string $message Commit message * * @throws * @@ -266,7 +267,7 @@ class Commit /** * Set commit tag. * - * @param Repository $tag Commit tag + * @param Tag $tag Commit tag * * @since 1.0.0 * @author Dennis Eichhorn diff --git a/Utils/Git/Git.php b/Utils/Git/Git.php index a6c81c8db..038dd035c 100644 --- a/Utils/Git/Git.php +++ b/Utils/Git/Git.php @@ -14,6 +14,7 @@ * @link http://orange-management.com */ namespace phpOMS\Utils\Git; +use phpOMS\System\File\PathException; /** * Gray encoding class @@ -39,6 +40,8 @@ class Git { * Set git binary. * * @param string $path Git path + * + * @throws PathException * * @since 1.0.0 * @author Dennis Eichhorn @@ -46,7 +49,7 @@ class Git { public static function setBin(string $path) { if (realpath($path) === false) { - throw new \PathException($path); + throw new PathException($path); } self::$bin = realpath($path); diff --git a/Utils/Git/Repository.php b/Utils/Git/Repository.php index ad715bf1b..c609ca238 100644 --- a/Utils/Git/Repository.php +++ b/Utils/Git/Repository.php @@ -14,6 +14,7 @@ * @link http://orange-management.com */ namespace phpOMS\Utils\Git; +use phpOMS\System\File\PathException; /** * Repository class @@ -71,6 +72,8 @@ class Repository * @param string $source Create repository from source (optional, can be remote) * @param bool $bare Bare repository * + * @throws \Exception + * * @since 1.0.0 * @author Dennis Eichhorn */ @@ -92,13 +95,15 @@ class Repository * * @param string $path Path to repository * + * @throws PathException + * * @since 1.0.0 * @author Dennis Eichhorn */ private function setPath(string $path) { if (!is_dir($path)) { - throw new \PathException($path); + throw new PathException($path); } $this->path = realpath($path); @@ -120,6 +125,8 @@ class Repository * * @param string $cmd Command to run * + * @throws \Exception + * * @since 1.0.0 * @author Dennis Eichhorn */ @@ -152,7 +159,7 @@ class Repository $status = trim(proc_close($resource)); if ($status) { - throw new Exception($stderr); + throw new \Exception($stderr); } return $stdout; diff --git a/Utils/IO/Zip/Zip.php b/Utils/IO/Zip/Zip.php index 4c3cdc482..525c65f7c 100644 --- a/Utils/IO/Zip/Zip.php +++ b/Utils/IO/Zip/Zip.php @@ -53,7 +53,7 @@ class Zip } $zip = new \ZipArchive(); - if (!$zip->open($destination, $overwrite ? \ZIPARCHIVE::OVERWRITE : \ZIPARCHIVE::CREATE)) { + if (!$zip->open($destination, $overwrite ? \ZipArchive::OVERWRITE : \ZipArchive::CREATE)) { return false; } diff --git a/Utils/RnG/ArrayRandomize.php b/Utils/RnG/ArrayRandomize.php index 1adf888b6..8706138b8 100644 --- a/Utils/RnG/ArrayRandomize.php +++ b/Utils/RnG/ArrayRandomize.php @@ -32,7 +32,9 @@ class ArrayRandomize /** * Yates array shuffler. * - * @return string + * @param array $arr Array to randomize + * + * @return array * * @since 1.0.0 * @author Dennis Eichhorn @@ -53,7 +55,9 @@ class ArrayRandomize /** * Knuths array shuffler. * - * @return string + * @param array $arr Array to randomize + * + * @return array * * @since 1.0.0 * @author Dennis Eichhorn diff --git a/Utils/RnG/LinearCongruentialGenerator.php b/Utils/RnG/LinearCongruentialGenerator.php index 944280743..c3b84ed62 100644 --- a/Utils/RnG/LinearCongruentialGenerator.php +++ b/Utils/RnG/LinearCongruentialGenerator.php @@ -32,6 +32,8 @@ class LinearCongruentialGenerator /** * BSD random number * + * @param int $seed Starting seed + * * @return \Closure * * @since 1.0.0 @@ -47,6 +49,8 @@ class LinearCongruentialGenerator /** * MS random number * + * @param int $seed Starting seed + * * @return \Closure * * @since 1.0.0 diff --git a/Utils/RnG/Phone.php b/Utils/RnG/Phone.php index 1111efd37..ba19f40f9 100644 --- a/Utils/RnG/Phone.php +++ b/Utils/RnG/Phone.php @@ -62,7 +62,7 @@ class Phone $numberParts = substr_count($layout['struct'], '$'); for ($i = ($isInt ? 2 : 1); $i < $numberParts; $i++) { - $numberString = str_replace('$' . $i, String::generateString($layout['size'][$i - 1][0], $layout['size'][$i - 1][1], '0123456789'), $numberString); + $numberString = str_replace('$' . $i, StringUtils::generateString($layout['size'][$i - 1][0], $layout['size'][$i - 1][1], '0123456789'), $numberString); } return $numberString; diff --git a/Utils/TaskSchedule/Interval.php b/Utils/TaskSchedule/Interval.php index af7ab29b9..8afcc2b73 100644 --- a/Utils/TaskSchedule/Interval.php +++ b/Utils/TaskSchedule/Interval.php @@ -230,8 +230,6 @@ class Interval * Set mintue. * * @param array $minute Minute - * @param int $start Start/first - * @param int $end End/last * @param int $step Step * @param bool $any Any * @@ -258,8 +256,6 @@ class Interval * Set hour. * * @param array $hour Hour - * @param int $start Start/first - * @param int $end End/last * @param int $step Step * @param bool $any Any * @@ -286,8 +282,6 @@ class Interval * Set day of month. * * @param array $dayOfMonth Day of month - * @param int $start Start/first - * @param int $end End/last * @param int $step Step * @param bool $any Any * @param bool $last Last @@ -318,8 +312,6 @@ class Interval * Set month. * * @param array $month Month - * @param int $start Start/first - * @param int $end End/last * @param int $step Step * @param bool $any Any * @@ -346,8 +338,6 @@ class Interval * Set day of week. * * @param array $dayOfWeek Day of week - * @param int $start Start/first - * @param int $end End/last * @param int $step Step * @param bool $any Any * @param bool $last Last @@ -376,8 +366,6 @@ class Interval * Set yaer. * * @param array $year Year - * @param int $start Start/first - * @param int $end End/last * @param int $step Step * @param bool $any Any * diff --git a/Validation/BitcoinValidator.php b/Validation/BitcoinValidator.php index 994f49e56..c53d0d2e8 100644 --- a/Validation/BitcoinValidator.php +++ b/Validation/BitcoinValidator.php @@ -19,7 +19,7 @@ class BitcoinValidator { public static function validate(string $addr) : bool { - $decoded = decodeBase58($address); + $decoded = self::decodeBase58($addr); $d1 = hash("sha256", substr($decoded, 0, 21), true); $d2 = hash("sha256", $d1, true); diff --git a/Views/View.php b/Views/View.php index 64d0bed3e..b4e744fc3 100644 --- a/Views/View.php +++ b/Views/View.php @@ -375,6 +375,8 @@ class View implements \Serializable /** * Unserialize view. * + * @param string $raw Raw data to parse + * * @return void * * @since 1.0.0