PhpStorm fixes

This commit is contained in:
Dennis Eichhorn 2016-04-16 12:03:42 +02:00
parent 669c3b7244
commit f673579340
30 changed files with 92 additions and 59 deletions

View File

@ -550,6 +550,7 @@ abstract class DataMapperAbstract implements DataMapperInterface
* Populate data. * Populate data.
* *
* @param array $result Result set * @param array $result Result set
* @param mixed $obj Object to populate
* *
* @return mixed * @return mixed
* *
@ -597,7 +598,7 @@ abstract class DataMapperAbstract implements DataMapperInterface
$reflectionProperty = $reflectionClass->getProperty($member); $reflectionProperty = $reflectionClass->getProperty($member);
$mapper = new $rel['mapper']($this->db); $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. * Get object.
* *
* @param int $relations Load relations
*
* @return array * @return array
* *
* @since 1.0.0 * @since 1.0.0
@ -812,6 +815,7 @@ abstract class DataMapperAbstract implements DataMapperInterface
* *
* @param int $limit Newest limit * @param int $limit Newest limit
* @param Builder $query Pre-defined query * @param Builder $query Pre-defined query
* @param int $relations Load relations
* *
* @return mixed * @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 */ /* 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) { if ($hasMany) {
$this->populateManyToMany($this->getManyRaw($key, $relations), $obj[$key]); $this->populateManyToMany($this->getManyRaw($key, $relations), $obj[$key]);
} }
@ -985,6 +989,7 @@ abstract class DataMapperAbstract implements DataMapperInterface
* Get raw by primary key * Get raw by primary key
* *
* @param mixed $primaryKey Primary key * @param mixed $primaryKey Primary key
* @param int $relations Load relations
* *
* @return array * @return array
* *

View File

@ -265,7 +265,7 @@ class Builder extends BuilderAbstract
/** /**
* Creating new. * Creating new.
* *
* @return self * @return Builder
* *
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com> * @author Dennis Eichhorn <d.eichhorn@oms.com>
@ -718,6 +718,7 @@ class Builder extends BuilderAbstract
* Values to insert. * Values to insert.
* *
* @param mixed $value Values * @param mixed $value Values
* @param string $type Data type to insert
* *
* @return Builder * @return Builder
* *

View File

@ -40,7 +40,7 @@ class ConsoleSession implements SessionInterface
/** /**
* Constructor. * Constructor.
* *
* @param string|int $sid Session id * @param string|int|bool $sid Session id
* *
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com> * @author Dennis Eichhorn <d.eichhorn@oms.com>

View File

@ -40,7 +40,7 @@ class SocketSession implements SessionInterface
/** /**
* Constructor. * Constructor.
* *
* @param string|int $sid Session id * @param string|int|bool $sid Session id
* *
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com> * @author Dennis Eichhorn <d.eichhorn@oms.com>

View File

@ -135,7 +135,7 @@ class Functions
return self::ackermann($m - 1, 1); return self::ackermann($m - 1, 1);
} }
return ackermann($m - 1, ackermann($m, $n - 1)); return self::ackermann($m - 1, self::ackermann($m, $n - 1));
} }
/** /**

View File

@ -2,12 +2,12 @@
namespace phpOMS\Math\Matrix; namespace phpOMS\Math\Matrix;
class Matrix implements ArrayAccess, Iterator class Matrix implements \ArrayAccess, \Iterator
{ {
private $matrix = []; protected $matrix = [];
private $n = 0; protected $n = 0;
private $m = 0; protected $m = 0;
public function __construct(int $m, int $n = 1) public function __construct(int $m, int $n = 1)
{ {
@ -46,7 +46,7 @@ class Matrix implements ArrayAccess, Iterator
public function transpose() : Matrix public function transpose() : Matrix
{ {
$matrix = new Matrix($this->n, $this->m); $matrix = new Matrix($this->n, $this->m);
$matrix->setMatrix(array_map(null, ...$matrix)); $matrix->setMatrix(array_map(null, $matrix->getMatrix()));
return $matrix; return $matrix;
} }
@ -58,6 +58,8 @@ class Matrix implements ArrayAccess, Iterator
} elseif (is_scalar($value)) { } elseif (is_scalar($value)) {
return $this->multScalar($value); return $this->multScalar($value);
} }
throw new \Exception();
} }
private function multMatrix(Matrix $matrix) : Matrix private function multMatrix(Matrix $matrix) : Matrix
@ -113,15 +115,19 @@ class Matrix implements ArrayAccess, Iterator
} elseif (is_scalar($value)) { } elseif (is_scalar($value)) {
return $this->addScalar($value); return $this->addScalar($value);
} }
throw new \Exception();
} }
public function sub($value) : Matrix public function sub($value) : Matrix
{ {
if ($value instanceOf Matrix) { if ($value instanceOf Matrix) {
return $this->add($this->multMatrix(-1)); return $this->add($this->mult(-1));
} elseif (is_scalar($value)) { } elseif (is_scalar($value)) {
return $this->addScalar(-$value); return $this->add(-$value);
} }
throw new \Exception();
} }
private function addMatrix(Matrix $value) : Matrix private function addMatrix(Matrix $value) : Matrix
@ -177,11 +183,6 @@ class Matrix implements ArrayAccess, Iterator
return new Matrix($this->m, $this->n); return new Matrix($this->m, $this->n);
} }
public function diag() : Matrix
{
}
public function inverse(int $algorithm = InversionType::GAUSS_JORDAN) : Matrix public function inverse(int $algorithm = InversionType::GAUSS_JORDAN) : Matrix
{ {
if ($this->n !== $this->m) { if ($this->n !== $this->m) {

View File

@ -1,5 +1,7 @@
<?php <?php
class Integer implements Number use phpOMS\Math\Number\Prime;
class Integer implements Number
{ {
public static function isInteger($value) : bool public static function isInteger($value) : bool
{ {
@ -28,6 +30,8 @@ class Integer implements Number
$m -= $n; $m -= $n;
} }
} }
return 1;
} }
public static function trialFactorization(int $value) public static function trialFactorization(int $value)
@ -39,7 +43,7 @@ class Integer implements Number
$factors = []; $factors = [];
$primes = Prime::sieveOfEratosthenes((int) $value**0.5); $primes = Prime::sieveOfEratosthenes((int) $value**0.5);
for($primes as $prime) { foreach($primes as $prime) {
if($prime*$prime > $value) { if($prime*$prime > $value) {
break; break;
} }

View File

@ -14,6 +14,9 @@
* @link http://orange-management.com * @link http://orange-management.com
*/ */
namespace phpOMS\Math\Optimization\Graph; namespace phpOMS\Math\Optimization\Graph;
use phpOMS\Stdlib\Map\KeyType;
use phpOMS\Stdlib\Map\MultiMap;
use phpOMS\Stdlib\Map\OrderType;
/** /**
* Graph class * Graph class
@ -124,7 +127,7 @@ class Graph
* @param mixed $a First node of edge * @param mixed $a First node of edge
* @param mixed $b Second node of edge * @param mixed $b Second node of edge
* *
* @return EdgeInterface * @return bool
* *
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com> * @author Dennis Eichhorn <d.eichhorn@oms.com>
@ -191,7 +194,7 @@ class Graph
/** /**
* Get edge by id. * Get edge by id.
* *
* @param itn $id Edge id * @param int $id Edge id
* *
* @return EdgeInterface * @return EdgeInterface
* *

View File

@ -446,6 +446,8 @@ class Request extends RequestAbstract
* *
* @return int * @return int
* *
* @throws \Exception
*
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com> * @author Dennis Eichhorn <d.eichhorn@oms.com>
*/ */

View File

@ -15,8 +15,6 @@
*/ */
namespace phpOMS\Message\Http; namespace phpOMS\Message\Http;
use phpOMS\Message\Http\RequestMethod;
/** /**
* Rest request class. * Rest request class.
* *

View File

@ -35,14 +35,14 @@ class ActivateAbstract
* Install module. * Install module.
* *
* @param Pool $dbPool Database instance * @param Pool $dbPool Database instance
* @param array $info Module info * @param InfoManager $info Module info
* *
* @return void * @return void
* *
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com> * @author Dennis Eichhorn <d.eichhorn@oms.com>
*/ */
public static function activate(Pool $dbPool, array $info) public static function activate(Pool $dbPool, InfoManager $info)
{ {
} }
} }

View File

@ -35,14 +35,14 @@ class DeactivateAbstract
* Install module. * Install module.
* *
* @param Pool $dbPool Database instance * @param Pool $dbPool Database instance
* @param array $info Module info * @param InfoManager $info Module info
* *
* @return void * @return void
* *
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com> * @author Dennis Eichhorn <d.eichhorn@oms.com>
*/ */
public static function deactivate(Pool $dbPool, array $info) public static function deactivate(Pool $dbPool, InfoManager $info)
{ {
} }
} }

View File

@ -16,8 +16,7 @@
namespace phpOMS\Module; namespace phpOMS\Module;
use phpOMS\DataStorage\Database\Pool; use phpOMS\DataStorage\Database\Pool;
use phpOMS\Module\InfoManager; use phpOMS\System\File\PermissionException;
use phpOMS\Router\RouteVerb;
use phpOMS\Utils\Parser\Php\ArrayParser; use phpOMS\Utils\Parser\Php\ArrayParser;
/** /**
@ -38,7 +37,7 @@ class InstallerAbstract
* Install module. * Install module.
* *
* @param Pool $dbPool Database instance * @param Pool $dbPool Database instance
* @param array $info Module info * @param InfoManager $info Module info
* *
* @return void * @return void
* *
@ -60,13 +59,17 @@ class InstallerAbstract
* *
* @return void * @return void
* *
* @throws PermissionException
*
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com> * @author Dennis Eichhorn <d.eichhorn@oms.com>
*/ */
private static function installRoutes(string $destRoutePath, string $srcRoutePath) private static function installRoutes(string $destRoutePath, string $srcRoutePath)
{ {
if(file_exists($destRoutePath) && file_exists($srcRoutePath)) { if(file_exists($destRoutePath) && file_exists($srcRoutePath)) {
/** @noinspection PhpIncludeInspection */
$appRoutes = include $destRoutePath; $appRoutes = include $destRoutePath;
/** @noinspection PhpIncludeInspection */
$moduleRoutes = include $srcRoutePath; $moduleRoutes = include $srcRoutePath;
$appRoutes = array_merge_recursive($appRoutes, $moduleRoutes); $appRoutes = array_merge_recursive($appRoutes, $moduleRoutes);

View File

@ -35,7 +35,7 @@ class UninstallAbstract
* Install module. * Install module.
* *
* @param Pool $dbPool Database instance * @param Pool $dbPool Database instance
* @param array $info Module info * @param InfoManager $info Module info
* *
* @return void * @return void
* *

View File

@ -35,14 +35,14 @@ class UpdateAbstract
* Install module. * Install module.
* *
* @param Pool $dbPool Database instance * @param Pool $dbPool Database instance
* @param array $info Module info * @param InfoManager $info Module info
* *
* @return void * @return void
* *
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com> * @author Dennis Eichhorn <d.eichhorn@oms.com>
*/ */
public static function update(Pool $dbPool, array $info) public static function update(Pool $dbPool, InfoManager $info)
{ {
} }
} }

View File

@ -417,6 +417,8 @@ class Encryption
* *
* @return string * @return string
* *
* @throws \Exception
*
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com> * @author Dennis Eichhorn <d.eichhorn@oms.com>
*/ */

View File

@ -225,12 +225,14 @@ class Directory extends FileAbstract implements \Iterator, \ArrayAccess
* *
* @param string $name File/direcotry name * @param string $name File/direcotry name
* *
* @return FileAbstract
*
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com> * @author Dennis Eichhorn <d.eichhorn@oms.com>
*/ */
public function get(string $name) : FileAbstract 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 * @param FileAbstract $file File to add
* *
* @return bool
*
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com> * @author Dennis Eichhorn <d.eichhorn@oms.com>
*/ */

View File

@ -79,7 +79,7 @@ class File extends FileAbstract
*/ */
public function createNode() : bool public function createNode() : bool
{ {
return self::create($this->path); return self::createFile($this->path);
} }
/** /**

View File

@ -208,6 +208,7 @@ class ArrayUtils
public static function arrayToCSV(array $data, string $delimiter = ';', string $enclosure = '"', string $escape = '\\') : string public static function arrayToCSV(array $data, string $delimiter = ';', string $enclosure = '"', string $escape = '\\') : string
{ {
$outstream = fopen('php://memory', 'r+'); $outstream = fopen('php://memory', 'r+');
/** @noinspection PhpMethodParametersCountMismatchInspection */
fputcsv($outstream, $data, $delimiter, $enclosure, $escape); fputcsv($outstream, $data, $delimiter, $enclosure, $escape);
rewind($outstream); rewind($outstream);
$csv = fgets($outstream); $csv = fgets($outstream);

View File

@ -18,7 +18,7 @@ class Aztec
} }
private function arrange() { private function arange() {
} }
} }

View File

@ -14,6 +14,7 @@
* @link http://orange-management.com * @link http://orange-management.com
*/ */
namespace phpOMS\Utils\Git; namespace phpOMS\Utils\Git;
use phpDocumentor\Reflection\DocBlock\Tag;
/** /**
* Gray encoding class * Gray encoding class
@ -153,7 +154,7 @@ class Commit
/** /**
* Set commit message. * Set commit message.
* *
* @param string $path File path * @param string $message Commit message
* *
* @throws * @throws
* *
@ -266,7 +267,7 @@ class Commit
/** /**
* Set commit tag. * Set commit tag.
* *
* @param Repository $tag Commit tag * @param Tag $tag Commit tag
* *
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com> * @author Dennis Eichhorn <d.eichhorn@oms.com>

View File

@ -14,6 +14,7 @@
* @link http://orange-management.com * @link http://orange-management.com
*/ */
namespace phpOMS\Utils\Git; namespace phpOMS\Utils\Git;
use phpOMS\System\File\PathException;
/** /**
* Gray encoding class * Gray encoding class
@ -39,6 +40,8 @@ class Git {
* Set git binary. * Set git binary.
* *
* @param string $path Git path * @param string $path Git path
*
* @throws PathException
* *
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com> * @author Dennis Eichhorn <d.eichhorn@oms.com>
@ -46,7 +49,7 @@ class Git {
public static function setBin(string $path) public static function setBin(string $path)
{ {
if (realpath($path) === false) { if (realpath($path) === false) {
throw new \PathException($path); throw new PathException($path);
} }
self::$bin = realpath($path); self::$bin = realpath($path);

View File

@ -14,6 +14,7 @@
* @link http://orange-management.com * @link http://orange-management.com
*/ */
namespace phpOMS\Utils\Git; namespace phpOMS\Utils\Git;
use phpOMS\System\File\PathException;
/** /**
* Repository class * Repository class
@ -71,6 +72,8 @@ class Repository
* @param string $source Create repository from source (optional, can be remote) * @param string $source Create repository from source (optional, can be remote)
* @param bool $bare Bare repository * @param bool $bare Bare repository
* *
* @throws \Exception
*
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com> * @author Dennis Eichhorn <d.eichhorn@oms.com>
*/ */
@ -92,13 +95,15 @@ class Repository
* *
* @param string $path Path to repository * @param string $path Path to repository
* *
* @throws PathException
*
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com> * @author Dennis Eichhorn <d.eichhorn@oms.com>
*/ */
private function setPath(string $path) private function setPath(string $path)
{ {
if (!is_dir($path)) { if (!is_dir($path)) {
throw new \PathException($path); throw new PathException($path);
} }
$this->path = realpath($path); $this->path = realpath($path);
@ -120,6 +125,8 @@ class Repository
* *
* @param string $cmd Command to run * @param string $cmd Command to run
* *
* @throws \Exception
*
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com> * @author Dennis Eichhorn <d.eichhorn@oms.com>
*/ */
@ -152,7 +159,7 @@ class Repository
$status = trim(proc_close($resource)); $status = trim(proc_close($resource));
if ($status) { if ($status) {
throw new Exception($stderr); throw new \Exception($stderr);
} }
return $stdout; return $stdout;

View File

@ -53,7 +53,7 @@ class Zip
} }
$zip = new \ZipArchive(); $zip = new \ZipArchive();
if (!$zip->open($destination, $overwrite ? \ZIPARCHIVE::OVERWRITE : \ZIPARCHIVE::CREATE)) { if (!$zip->open($destination, $overwrite ? \ZipArchive::OVERWRITE : \ZipArchive::CREATE)) {
return false; return false;
} }

View File

@ -32,7 +32,9 @@ class ArrayRandomize
/** /**
* Yates array shuffler. * Yates array shuffler.
* *
* @return string * @param array $arr Array to randomize
*
* @return array
* *
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com> * @author Dennis Eichhorn <d.eichhorn@oms.com>
@ -53,7 +55,9 @@ class ArrayRandomize
/** /**
* Knuths array shuffler. * Knuths array shuffler.
* *
* @return string * @param array $arr Array to randomize
*
* @return array
* *
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com> * @author Dennis Eichhorn <d.eichhorn@oms.com>

View File

@ -32,6 +32,8 @@ class LinearCongruentialGenerator
/** /**
* BSD random number * BSD random number
* *
* @param int $seed Starting seed
*
* @return \Closure * @return \Closure
* *
* @since 1.0.0 * @since 1.0.0
@ -47,6 +49,8 @@ class LinearCongruentialGenerator
/** /**
* MS random number * MS random number
* *
* @param int $seed Starting seed
*
* @return \Closure * @return \Closure
* *
* @since 1.0.0 * @since 1.0.0

View File

@ -62,7 +62,7 @@ class Phone
$numberParts = substr_count($layout['struct'], '$'); $numberParts = substr_count($layout['struct'], '$');
for ($i = ($isInt ? 2 : 1); $i < $numberParts; $i++) { 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; return $numberString;

View File

@ -230,8 +230,6 @@ class Interval
* Set mintue. * Set mintue.
* *
* @param array $minute Minute * @param array $minute Minute
* @param int $start Start/first
* @param int $end End/last
* @param int $step Step * @param int $step Step
* @param bool $any Any * @param bool $any Any
* *
@ -258,8 +256,6 @@ class Interval
* Set hour. * Set hour.
* *
* @param array $hour Hour * @param array $hour Hour
* @param int $start Start/first
* @param int $end End/last
* @param int $step Step * @param int $step Step
* @param bool $any Any * @param bool $any Any
* *
@ -286,8 +282,6 @@ class Interval
* Set day of month. * Set day of month.
* *
* @param array $dayOfMonth Day of month * @param array $dayOfMonth Day of month
* @param int $start Start/first
* @param int $end End/last
* @param int $step Step * @param int $step Step
* @param bool $any Any * @param bool $any Any
* @param bool $last Last * @param bool $last Last
@ -318,8 +312,6 @@ class Interval
* Set month. * Set month.
* *
* @param array $month Month * @param array $month Month
* @param int $start Start/first
* @param int $end End/last
* @param int $step Step * @param int $step Step
* @param bool $any Any * @param bool $any Any
* *
@ -346,8 +338,6 @@ class Interval
* Set day of week. * Set day of week.
* *
* @param array $dayOfWeek Day of week * @param array $dayOfWeek Day of week
* @param int $start Start/first
* @param int $end End/last
* @param int $step Step * @param int $step Step
* @param bool $any Any * @param bool $any Any
* @param bool $last Last * @param bool $last Last
@ -376,8 +366,6 @@ class Interval
* Set yaer. * Set yaer.
* *
* @param array $year Year * @param array $year Year
* @param int $start Start/first
* @param int $end End/last
* @param int $step Step * @param int $step Step
* @param bool $any Any * @param bool $any Any
* *

View File

@ -19,7 +19,7 @@ class BitcoinValidator
{ {
public static function validate(string $addr) : bool public static function validate(string $addr) : bool
{ {
$decoded = decodeBase58($address); $decoded = self::decodeBase58($addr);
$d1 = hash("sha256", substr($decoded, 0, 21), true); $d1 = hash("sha256", substr($decoded, 0, 21), true);
$d2 = hash("sha256", $d1, true); $d2 = hash("sha256", $d1, true);

View File

@ -375,6 +375,8 @@ class View implements \Serializable
/** /**
* Unserialize view. * Unserialize view.
* *
* @param string $raw Raw data to parse
*
* @return void * @return void
* *
* @since 1.0.0 * @since 1.0.0