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.
*
* @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
*

View File

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

View File

@ -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 <d.eichhorn@oms.com>

View File

@ -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 <d.eichhorn@oms.com>

View File

@ -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));
}
/**

View File

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

View File

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

View File

@ -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 <d.eichhorn@oms.com>
@ -191,7 +194,7 @@ class Graph
/**
* Get edge by id.
*
* @param itn $id Edge id
* @param int $id Edge id
*
* @return EdgeInterface
*

View File

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

View File

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

View File

@ -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 <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.
*
* @param Pool $dbPool Database instance
* @param array $info Module info
* @param InfoManager $info Module info
*
* @return void
*
* @since 1.0.0
* @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;
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 <d.eichhorn@oms.com>
*/
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);

View File

@ -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
*

View File

@ -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 <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
*
* @throws \Exception
*
* @since 1.0.0
* @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
*
* @return FileAbstract
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
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 <d.eichhorn@oms.com>
*/

View File

@ -79,7 +79,7 @@ class File extends FileAbstract
*/
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
{
$outstream = fopen('php://memory', 'r+');
/** @noinspection PhpMethodParametersCountMismatchInspection */
fputcsv($outstream, $data, $delimiter, $enclosure, $escape);
rewind($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
*/
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 <d.eichhorn@oms.com>

View File

@ -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 <d.eichhorn@oms.com>
@ -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);

View File

@ -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 <d.eichhorn@oms.com>
*/
@ -92,13 +95,15 @@ class Repository
*
* @param string $path Path to repository
*
* @throws PathException
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
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 <d.eichhorn@oms.com>
*/
@ -152,7 +159,7 @@ class Repository
$status = trim(proc_close($resource));
if ($status) {
throw new Exception($stderr);
throw new \Exception($stderr);
}
return $stdout;

View File

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

View File

@ -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 <d.eichhorn@oms.com>
@ -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 <d.eichhorn@oms.com>

View File

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

View File

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

View File

@ -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
*

View File

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

View File

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