Formatting & bug fixes

This commit is contained in:
Dennis Eichhorn 2016-05-05 11:27:16 +02:00
parent 292ac8d739
commit ce182bab92
166 changed files with 2560 additions and 3372 deletions

View File

@ -422,7 +422,8 @@ class Account
$this->lastActive = new \DateTime('NOW'); $this->lastActive = new \DateTime('NOW');
} }
public function setCreatedAt(\DateTime $created) { public function setCreatedAt(\DateTime $created)
{
$this->createdAt = $created; $this->createdAt = $created;
} }

View File

@ -112,7 +112,8 @@ class AccountManager implements \Countable
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com> * @author Dennis Eichhorn <d.eichhorn@oms.com>
*/ */
public function count() : int { public function count() : int
{
return count($this->accounts); return count($this->accounts);
} }

View File

@ -124,6 +124,7 @@ class MemCache implements CacheInterface
*/ */
public function stats() : array public function stats() : array
{ {
/** @noinspection PhpMethodOrClassCallIsNotCaseSensitiveInspection */
return $this->memc->getExtendedStats(); return $this->memc->getExtendedStats();
} }

View File

@ -15,6 +15,7 @@
*/ */
namespace phpOMS\DataStorage\Database; namespace phpOMS\DataStorage\Database;
use phpOMS\DataStorage\Database\Connection\ConnectionAbstract; use phpOMS\DataStorage\Database\Connection\ConnectionAbstract;
/** /**

View File

@ -262,7 +262,8 @@ abstract class DataMapperAbstract implements DataMapperInterface
return $this; return $this;
} }
public function clear() { public function clear()
{
$this->fields = []; $this->fields = [];
} }
@ -361,7 +362,7 @@ abstract class DataMapperAbstract implements DataMapperInterface
$value = isset($value) ? json_encode($value) : ''; $value = isset($value) ? json_encode($value) : '';
} elseif ($column['type'] === 'Serializable') { } elseif ($column['type'] === 'Serializable') {
$value = $value->serialize(); $value = $value->serialize();
} elseif(is_object($value)) { } elseif (is_object($value)) {
$value = $value->getId(); $value = $value->getId();
} }
@ -1005,15 +1006,15 @@ abstract class DataMapperAbstract implements DataMapperInterface
->where($value['table'] . '.' . $value['dst'], '=', $primaryKey); ->where($value['table'] . '.' . $value['dst'], '=', $primaryKey);
} elseif ($relations === RelationType::NEWEST) { } elseif ($relations === RelationType::NEWEST) {
/* /*
SELECT c.*, p1.* SELECT c.*, p1.*
FROM customer c FROM customer c
JOIN purchase p1 ON (c.id = p1.customer_id) JOIN purchase p1 ON (c.id = p1.customer_id)
LEFT OUTER JOIN purchase p2 ON (c.id = p2.customer_id AND LEFT OUTER JOIN purchase p2 ON (c.id = p2.customer_id AND
(p1.date < p2.date OR p1.date = p2.date AND p1.id < p2.id)) (p1.date < p2.date OR p1.date = p2.date AND p1.id < p2.id))
WHERE p2.id IS NULL; WHERE p2.id IS NULL;
*/ */
/* /*
$query->select(static::$table . '.' . static::$primaryField, $value['table'] . '.' . $value['src']) $query->select(static::$table . '.' . static::$primaryField, $value['table'] . '.' . $value['src'])
->from(static::$table) ->from(static::$table)
->join($value['table']) ->join($value['table'])

View File

@ -42,7 +42,7 @@ class DatabaseExceptionFactory
*/ */
public static function create(\PDOException $e) : \PDOException public static function create(\PDOException $e) : \PDOException
{ {
switch($e->getCode()) { switch ($e->getCode()) {
case '42S02': case '42S02':
return self::createTableViewException($e); return self::createTableViewException($e);
default: default:

View File

@ -89,7 +89,7 @@ abstract class GrammarAbstract
implode(' ', implode(' ',
array_filter( array_filter(
$this->compileComponents($query), $this->compileComponents($query),
function($value) { function ($value) {
return (string) $value !== ''; return (string) $value !== '';
} }
) )

View File

@ -47,16 +47,16 @@ class TableException extends \PDOException
{ {
$pos1 = strpos($message, '\''); $pos1 = strpos($message, '\'');
if($pos1 === false) { if ($pos1 === false) {
return $message; return $message;
} }
$pos2 = strpos($message, '\'', $pos1+1); $pos2 = strpos($message, '\'', $pos1 + 1);
if($pos2 === false) { if ($pos2 === false) {
return $message; return $message;
} }
return substr($message, $pos1+1, $pos2-$pos1-1); return substr($message, $pos1 + 1, $pos2 - $pos1 - 1);
} }
} }

View File

@ -14,6 +14,7 @@
* @link http://orange-management.com * @link http://orange-management.com
*/ */
namespace phpOMS\DataStorage\Session; namespace phpOMS\DataStorage\Session;
use phpOMS\Uri\UriFactory; use phpOMS\Uri\UriFactory;
use phpOMS\Utils\RnG\StringUtils; use phpOMS\Utils\RnG\StringUtils;

View File

@ -262,12 +262,12 @@ class FileLogger implements LoggerInterface
* @param array $a * @param array $a
* @param array $b * @param array $b
* *
* @return bool the comparison * @return int
* *
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn * @author Dennis Eichhorn
*/ */
private function orderSort($a, $b) private function orderSort($a, $b) : int
{ {
if ($a['time'] == $b['time']) { if ($a['time'] == $b['time']) {
return 0; return 0;
@ -297,7 +297,7 @@ class FileLogger implements LoggerInterface
} }
if (self::$verbose) { if (self::$verbose) {
echo $message , "\n"; echo $message, "\n";
} }
} }

View File

@ -31,7 +31,7 @@ class Fibunacci
{ {
public static function isFibunacci(int $n) 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 public static function fibunacci(int $n, int $start = 1) : int
@ -57,6 +57,6 @@ class Fibunacci
public static function binet(int $n) : int 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

@ -149,7 +149,8 @@ class Functions
* @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 invMod($a, $n) { public static function invMod($a, $n)
{
if ($n < 0) { if ($n < 0) {
$n = -$n; $n = -$n;
} }

View File

@ -2,13 +2,14 @@
namespace phpOMS\Math\Matrix; namespace phpOMS\Math\Matrix;
class IdentityMatrix extends Matrix { class IdentityMatrix extends Matrix
{
public function __constrcut(int $n) public function __constrcut(int $n)
{ {
$this->n = $n; $this->n = $n;
$this->m = $n; $this->m = $n;
for($i = 0; $i < $n; $i++) { for ($i = 0; $i < $n; $i++) {
$this->matrix[$i] = array_fill(0, $n, 0); $this->matrix[$i] = array_fill(0, $n, 0);
$this->matrix[$i][$i] = 1; $this->matrix[$i][$i] = 1;
} }

View File

@ -172,7 +172,9 @@ class Matrix implements \ArrayAccess, \Iterator
$matrix = new Matrix($this->n, $this->n); $matrix = new Matrix($this->n, $this->n);
$matrixArr = $this->matrix; $matrixArr = $this->matrix;
$matrix->setMatrix($this->upperTrianglize($matrixArr)); $this->upperTrianglize($matrixArr);
$matrix->setMatrix($matrixArr);
return $matrix; return $matrix;
} }
@ -348,4 +350,122 @@ class Matrix implements \ArrayAccess, \Iterator
return $prod; return $prod;
} }
/**
* Return the current element
* @link http://php.net/manual/en/iterator.current.php
* @return mixed Can return any type.
* @since 5.0.0
*/
public function current()
{
// TODO: Implement current() method.
}
/**
* Move forward to next element
* @link http://php.net/manual/en/iterator.next.php
* @return void Any returned value is ignored.
* @since 5.0.0
*/
public function next()
{
// TODO: Implement next() method.
}
/**
* Return the key of the current element
* @link http://php.net/manual/en/iterator.key.php
* @return mixed scalar on success, or null on failure.
* @since 5.0.0
*/
public function key()
{
// TODO: Implement key() method.
}
/**
* Checks if current position is valid
* @link http://php.net/manual/en/iterator.valid.php
* @return boolean The return value will be casted to boolean and then evaluated.
* Returns true on success or false on failure.
* @since 5.0.0
*/
public function valid()
{
// TODO: Implement valid() method.
}
/**
* Rewind the Iterator to the first element
* @link http://php.net/manual/en/iterator.rewind.php
* @return void Any returned value is ignored.
* @since 5.0.0
*/
public function rewind()
{
// TODO: Implement rewind() method.
}
/**
* Whether a offset exists
* @link http://php.net/manual/en/arrayaccess.offsetexists.php
* @param mixed $offset <p>
* An offset to check for.
* </p>
* @return boolean true on success or false on failure.
* </p>
* <p>
* The return value will be casted to boolean if non-boolean was returned.
* @since 5.0.0
*/
public function offsetExists($offset)
{
// TODO: Implement offsetExists() method.
}
/**
* Offset to retrieve
* @link http://php.net/manual/en/arrayaccess.offsetget.php
* @param mixed $offset <p>
* The offset to retrieve.
* </p>
* @return mixed Can return all value types.
* @since 5.0.0
*/
public function offsetGet($offset)
{
// TODO: Implement offsetGet() method.
}
/**
* Offset to set
* @link http://php.net/manual/en/arrayaccess.offsetset.php
* @param mixed $offset <p>
* The offset to assign the value to.
* </p>
* @param mixed $value <p>
* The value to set.
* </p>
* @return void
* @since 5.0.0
*/
public function offsetSet($offset, $value)
{
// TODO: Implement offsetSet() method.
}
/**
* Offset to unset
* @link http://php.net/manual/en/arrayaccess.offsetunset.php
* @param mixed $offset <p>
* The offset to unset.
* </p>
* @return void
* @since 5.0.0
*/
public function offsetUnset($offset)
{
// TODO: Implement offsetUnset() method.
}
} }

View File

@ -2,7 +2,8 @@
namespace phpOMS\Math\Matrix; namespace phpOMS\Math\Matrix;
class Vector extends Matrix { class Vector extends Matrix
{
public function __construct(int $m) public function __construct(int $m)
{ {
parent::__construct($m); parent::__construct($m);

View File

@ -1,7 +1,7 @@
<?php <?php
use phpOMS\Math\Number\Prime; use phpOMS\Math\Number\Prime;
class Integer implements Number class Integer
{ {
public static function isInteger($value) : bool public static function isInteger($value) : bool
{ {
@ -24,7 +24,8 @@ class Integer implements Number
while (true) { while (true) {
if ($n === $m) { if ($n === $m) {
return $m; return $m;
} if ($n > $m) { }
if ($n > $m) {
$n -= $m; $n -= $m;
} else { } else {
$m -= $n; $m -= $n;
@ -41,20 +42,20 @@ class Integer implements Number
} }
$factors = []; $factors = [];
$primes = Prime::sieveOfEratosthenes((int) $value**0.5); $primes = Prime::sieveOfEratosthenes((int) $value ** 0.5);
foreach($primes as $prime) { foreach ($primes as $prime) {
if($prime*$prime > $value) { if ($prime * $prime > $value) {
break; break;
} }
while($value%$prime === 0) { while ($value % $prime === 0) {
$factors[] = $prime; $factors[] = $prime;
$value /= $prime; $value /= $prime;
} }
} }
if($value > 1) { if ($value > 1) {
$factors[] = $value; $factors[] = $value;
} }
@ -63,10 +64,10 @@ class Integer implements Number
public static function pollardsRho($value, $x = 2, $factor = 1, $cycleSize = 2, $xFixed = 2) public static function pollardsRho($value, $x = 2, $factor = 1, $cycleSize = 2, $xFixed = 2)
{ {
while($factor === 1) { while ($factor === 1) {
for($i = 1; $i < $cycleSize && $factor <= 1; $i++) { for ($i = 1; $i < $cycleSize && $factor <= 1; $i++) {
$x = ($x*$x+1)%$value; $x = ($x * $x + 1) % $value;
$factor = self::greatestCommonDivisor($x-$xFixed, $value); $factor = self::greatestCommonDivisor($x - $xFixed, $value);
} }
$cycleSize *= 2; $cycleSize *= 2;
@ -79,11 +80,11 @@ class Integer implements Number
public static function fermatFactor(int $value) public static function fermatFactor(int $value)
{ {
$a = $value; $a = $value;
$b2 = $a*$a - $value; $b2 = $a * $a - $value;
while(abs((int) round(sqrt($b2), 0) - sqrt($b2)) > 0.0001) { while (abs((int) round(sqrt($b2), 0) - sqrt($b2)) > 0.0001) {
$a += 1; $a += 1;
$b2 = $a*$a - $value; $b2 = $a * $a - $value;
} }
return $a - sqrt($b2); return $a - sqrt($b2);

View File

@ -1,6 +1,6 @@
<?php <?php
class Natural implements Number class Natural
{ {
public static function isNatural($value) : bool public static function isNatural($value) : bool
{ {

View File

@ -1,5 +1,9 @@
class Number { <?php
public static function getType($number) {
} class Number
{
public static function getType($number)
{
}
} }

View File

@ -1,8 +0,0 @@
interface NumberInterface {
public function add($number);
public function sub($number);
public function mult($number);
public function div($number);
public function pow($p);
public function abs($number);
}

View File

@ -0,0 +1,16 @@
<?php
interface NumberInterface
{
public function add($number);
public function sub($number);
public function mult($number);
public function div($number);
public function pow($p);
public function abs($number);
}

View File

@ -58,7 +58,7 @@ class Prime
*/ */
public static function mersenne(int $p) : int public static function mersenne(int $p) : int
{ {
return 2**$p - 1; return 2 ** $p - 1;
} }
/** /**
@ -123,7 +123,7 @@ class Prime
$range = range(2, $n); $range = range(2, $n);
$primes = array_combine($range, $range); $primes = array_combine($range, $range);
while ($number*$number < $n) { while ($number * $number < $n) {
for ($i = $number; $i <= $n; $i += $number) { for ($i = $number; $i <= $n; $i += $number) {
if ($i == $number) { if ($i == $number) {
continue; continue;

View File

@ -2,8 +2,10 @@
namespace phpOMS\Math\Optimization\Graph; namespace phpOMS\Math\Optimization\Graph;
class Dijkstra { class Dijkstra
public static function dijkstra(Graph $graph, $source, $target) { {
public static function dijkstra(Graph $graph, $source, $target)
{
$vertices = []; $vertices = [];
$neighbours = []; $neighbours = [];
@ -19,7 +21,7 @@ class Dijkstra {
$previous = []; $previous = [];
foreach ($vertices as $vertex) { foreach ($vertices as $vertex) {
$dist[$vertex] = INF; $dist[$vertex] = INF;
$previous[$vertex] = NULL; $previous[$vertex] = null;
} }
$dist[$source] = 0; $dist[$source] = 0;
@ -30,7 +32,7 @@ class Dijkstra {
// TODO - Find faster way to get minimum // TODO - Find faster way to get minimum
$min = INF; $min = INF;
foreach ($Q as $vertex){ foreach ($Q as $vertex) {
if ($dist[$vertex] < $min) { if ($dist[$vertex] < $min) {
$min = $dist[$vertex]; $min = $dist[$vertex];
$u = $vertex; $u = $vertex;

View File

@ -14,6 +14,7 @@
* @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\KeyType;
use phpOMS\Stdlib\Map\MultiMap; use phpOMS\Stdlib\Map\MultiMap;
use phpOMS\Stdlib\Map\OrderType; use phpOMS\Stdlib\Map\OrderType;
@ -149,8 +150,8 @@ class Graph
*/ */
public function removeEdgeById($id) : bool public function removeEdgeById($id) : bool
{ {
if (isset($this->edge[$id])) { if (isset($this->edges[$id])) {
unset($this->edge[$id]); unset($this->edges[$id]);
return true; return true;
} }
@ -203,7 +204,7 @@ class Graph
*/ */
public function getEdgeById(int $id) : EdgeInterface public function getEdgeById(int $id) : EdgeInterface
{ {
return $this->edges->get([$a, $b]) ?? new NullEdge(); return $this->edges->get($id) ?? new NullEdge();
} }
/** /**

View File

@ -0,0 +1,33 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright 2013 Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
namespace phpOMS\Math\Optimization\Graph;
/**
* Graph class
*
* @category Framework
* @package phpOMS\Asset
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @license OMS License 1.0
* @link http://orange-management.com
* @since 1.0.0
*/
class NullEdge
{
}

View File

@ -0,0 +1,33 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright 2013 Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
namespace phpOMS\Math\Optimization\Graph;
/**
* Graph class
*
* @category Framework
* @package phpOMS\Asset
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @license OMS License 1.0
* @link http://orange-management.com
* @since 1.0.0
*/
class NullVertice
{
}

View File

@ -16,7 +16,6 @@
namespace phpOMS\Math\Shape\D2; namespace phpOMS\Math\Shape\D2;
/** /**
* Polygon class. * Polygon class.
* *

View File

@ -15,6 +15,7 @@
*/ */
namespace phpOMS\Math\Stochastic\Distribution; namespace phpOMS\Math\Stochastic\Distribution;
use phpOMS\Math\Functions; use phpOMS\Math\Functions;
/** /**

View File

@ -15,6 +15,7 @@
*/ */
namespace phpOMS\Math\Stochastic\Distribution; namespace phpOMS\Math\Stochastic\Distribution;
use phpOMS\Math\Functions; use phpOMS\Math\Functions;
/** /**

View File

@ -151,7 +151,7 @@ class GeometricDistribution
*/ */
public static function getSkewness(float $lambda) : float public static function getSkewness(float $lambda) : float
{ {
return (2 - $p) / sqrt(1 - $p); return (2 - $lambda) / sqrt(1 - $lambda);
} }
/** /**
@ -166,7 +166,7 @@ class GeometricDistribution
*/ */
public static function getExKurtosis(float $lambda) : float public static function getExKurtosis(float $lambda) : float
{ {
return 6 + $p ** 2 / (1 - $p); return 6 + $lambda ** 2 / (1 - $lambda);
} }
public static function getRandom() public static function getRandom()

View File

@ -15,6 +15,7 @@
*/ */
namespace phpOMS\Math\Stochastic\Distribution; namespace phpOMS\Math\Stochastic\Distribution;
use phpOMS\Math\Functions; use phpOMS\Math\Functions;
/** /**

View File

@ -14,6 +14,7 @@
* @link http://orange-management.com * @link http://orange-management.com
*/ */
namespace phpOMS\Message; namespace phpOMS\Message;
use phpOMS\DataStorage\Cookie\CookieJar; use phpOMS\DataStorage\Cookie\CookieJar;
use phpOMS\DataStorage\Session\HttpSession; use phpOMS\DataStorage\Session\HttpSession;

View File

@ -164,7 +164,7 @@ class Header extends HeaderAbstract
*/ */
public function generate(string $code) public function generate(string $code)
{ {
switch($code) { switch ($code) {
case RequestStatus::R_403: case RequestStatus::R_403:
$this->generate403(); $this->generate403();
break; break;

View File

@ -452,7 +452,7 @@ class Request extends RequestAbstract
*/ */
public function getRouteVerb() : int public function getRouteVerb() : int
{ {
switch($this->getMethod()) { switch ($this->getMethod()) {
case RequestMethod::GET: case RequestMethod::GET:
return RouteVerb::GET; return RouteVerb::GET;
case RequestMethod::PUT: case RequestMethod::PUT:

View File

@ -110,7 +110,7 @@ class Response extends ResponseAbstract implements RenderableInterface
*/ */
public function render() : string public function render() : string
{ {
switch($this->header->get('Content-Type')) { switch ($this->header->get('Content-Type')) {
case MimeType::M_JSON: case MimeType::M_JSON:
return $this->getJson(); return $this->getJson();
default: default:
@ -154,7 +154,6 @@ class Response extends ResponseAbstract implements RenderableInterface
$render .= json_encode($response); $render .= json_encode($response);
// TODO: remove this. This should never happen since then someone forgot to set the correct header. it should be json header! // TODO: remove this. This should never happen since then someone forgot to set the correct header. it should be json header!
} else { } else {
var_dump($response);
throw new \Exception('Wrong response type'); throw new \Exception('Wrong response type');
} }
} }
@ -169,14 +168,14 @@ class Response extends ResponseAbstract implements RenderableInterface
{ {
$result = []; $result = [];
foreach($this->response as $key => $response) { foreach ($this->response as $key => $response) {
if($response instanceof View) { if ($response instanceof View) {
$result += $response->toArray(); $result += $response->toArray();
} elseif(is_array($response)) { } elseif (is_array($response)) {
$result += $response; $result += $response;
} elseif(is_scalar($response)) { } elseif (is_scalar($response)) {
$result[] = $response; $result[] = $response;
} elseif($response instanceof \Serializable) { } elseif ($response instanceof \Serializable) {
$result[] = $response->serialize(); $result[] = $response->serialize();
} else { } else {
throw new \Exception('Wrong response type'); throw new \Exception('Wrong response type');

View File

@ -44,7 +44,8 @@ class Rest
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn * @author Dennis Eichhorn
*/ */
public function setRequest(Request $request) { public function setRequest(Request $request)
{
$this->request = $request; $this->request = $request;
} }

View File

@ -40,11 +40,13 @@ class Imap extends Mail
return !($this->inbox === false); return !($this->inbox === false);
} }
public function getBoxes() { public function getBoxes()
{
return imap_list($this->inbox, $this->host, '*'); return imap_list($this->inbox, $this->host, '*');
} }
public function getQuota() { public function getQuota()
{
return imap_get_quotaroot($this->inbox, "INBOX"); return imap_get_quotaroot($this->inbox, "INBOX");
} }
@ -133,10 +135,12 @@ class Imap extends Mail
{ {
if ($encoding == 3) { if ($encoding == 3) {
return imap_base64($content); return imap_base64($content);
} else if ($encoding == 1) { } else {
if ($encoding == 1) {
return imap_8bit($content); return imap_8bit($content);
} else { } else {
return imap_qprint($content); return imap_qprint($content);
} }
} }
}
} }

View File

@ -211,7 +211,8 @@ abstract class RequestAbstract implements MessageInterface
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com> * @author Dennis Eichhorn <d.eichhorn@oms.com>
*/ */
public function setMethod(string $method) { public function setMethod(string $method)
{
$this->method = $method; $this->method = $method;
} }
@ -261,6 +262,7 @@ abstract class RequestAbstract implements MessageInterface
public function getData($key = null) public function getData($key = null)
{ {
$key = mb_strtolower($key); $key = mb_strtolower($key);
return !isset($key) ? $this->data : $this->data[$key] ?? null; return !isset($key) ? $this->data : $this->data[$key] ?? null;
} }

View File

@ -83,6 +83,8 @@ class InfoManager
/** /**
* Update info file * Update info file
* *
* @return void
*
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn * @author Dennis Eichhorn
*/ */

View File

@ -65,7 +65,7 @@ class InstallerAbstract
*/ */
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 */ /** @noinspection PhpIncludeInspection */
$appRoutes = include $destRoutePath; $appRoutes = include $destRoutePath;
/** @noinspection PhpIncludeInspection */ /** @noinspection PhpIncludeInspection */
@ -73,7 +73,7 @@ class InstallerAbstract
$appRoutes = array_merge_recursive($appRoutes, $moduleRoutes); $appRoutes = array_merge_recursive($appRoutes, $moduleRoutes);
if(is_writable($destRoutePath)) { if (is_writable($destRoutePath)) {
file_put_contents($destRoutePath, '<?php return ' . ArrayParser::serializeArray($appRoutes) . ';', LOCK_EX); file_put_contents($destRoutePath, '<?php return ' . ArrayParser::serializeArray($appRoutes) . ';', LOCK_EX);
} else { } else {
throw new PermissionException($destRoutePath); throw new PermissionException($destRoutePath);

View File

@ -124,5 +124,5 @@ class ModuleFactory
self::$loaded[$name]->addReceiving($providing); self::$loaded[$name]->addReceiving($providing);
} }
} }
} }
} }

View File

@ -314,10 +314,10 @@ class ModuleManager
foreach ($installed as $key => $value) { foreach ($installed as $key => $value) {
$this->installProviding($key, $module); $this->installProviding($key, $module);
} }
} catch(PathException $e) { } catch (PathException $e) {
// todo: handle module doesn't exist or files are missing // todo: handle module doesn't exist or files are missing
//echo $e->getMessage(); //echo $e->getMessage();
} catch(\Exception $e) { } catch (\Exception $e) {
//echo $e->getMessage(); //echo $e->getMessage();
} }
} }
@ -408,7 +408,7 @@ class ModuleManager
{ {
$class = '\\Modules\\' . $info->getDirectory() . '\\Admin\\Installer'; $class = '\\Modules\\' . $info->getDirectory() . '\\Admin\\Installer';
if(!Autoloader::exists($class)) { if (!Autoloader::exists($class)) {
throw new \Exception('Module installer does not exist'); throw new \Exception('Module installer does not exist');
} }

View File

@ -16,7 +16,6 @@
namespace phpOMS\Pattern; namespace phpOMS\Pattern;
/** /**
* Observer. * Observer.
* *

View File

@ -16,7 +16,6 @@
namespace phpOMS\Pattern; namespace phpOMS\Pattern;
/** /**
* Subject. * Subject.
* *

View File

@ -48,35 +48,43 @@ class ClientConnection
return $this->id; return $this->id;
} }
public function getSocket() { public function getSocket()
{
return $this->socket; return $this->socket;
} }
public function getHandshake() { public function getHandshake()
{
return $this->handshake; return $this->handshake;
} }
public function getPid() { public function getPid()
{
return $this->pid; return $this->pid;
} }
public function isConnected() { public function isConnected()
{
return $this->connected; return $this->connected;
} }
public function setSocket($socket) { public function setSocket($socket)
{
$this->socket = $socket; $this->socket = $socket;
} }
public function setHandshake($handshake) { public function setHandshake($handshake)
{
$this->handshake = $handshake; $this->handshake = $handshake;
} }
public function setPid($pid) { public function setPid($pid)
{
$this->pid = $pid; $this->pid = $pid;
} }
public function setConnected(bool $connected) { public function setConnected(bool $connected)
{
$this->connected = $connected; $this->connected = $connected;
} }
} }

View File

@ -16,7 +16,6 @@
namespace phpOMS\Socket\Packets; namespace phpOMS\Socket\Packets;
/** /**
* Server class. * Server class.
* *

View File

@ -33,9 +33,10 @@ class ClientManager
return $this->clients[$id] ?? new NullClientConnection(uniqid(), null); return $this->clients[$id] ?? new NullClientConnection(uniqid(), null);
} }
public function getBySocket($socket) { public function getBySocket($socket)
foreach($this->clients as $client) { {
if($client->getSocket() === $socket) { foreach ($this->clients as $client) {
if ($client->getSocket() === $socket) {
return $client; return $client;
} }
} }
@ -43,8 +44,9 @@ class ClientManager
return new NullClientConnection(uniqid(), null); return new NullClientConnection(uniqid(), null);
} }
public function remove($id) { public function remove($id)
if(isset($this->clients[$id])) { {
if (isset($this->clients[$id])) {
unset($this->clients[$id]); unset($this->clients[$id]);
return true; return true;

View File

@ -146,6 +146,7 @@ class Server extends SocketAbstract
$origin = $match[1]; $origin = $match[1];
} }
$key = '';
if (preg_match("/Sec-WebSocket-Key: (.*)\r\n/", $headers, $match)) { if (preg_match("/Sec-WebSocket-Key: (.*)\r\n/", $headers, $match)) {
$key = $match[1]; $key = $match[1];
} }
@ -159,6 +160,7 @@ class Server extends SocketAbstract
"\r\n\r\n"; "\r\n\r\n";
socket_write($client->getSocket(), $upgrade); socket_write($client->getSocket(), $upgrade);
$client->setHandshake(true); $client->setHandshake(true);
return true; return true;
} else { } else {
return false; return false;

View File

@ -14,6 +14,7 @@
* @link http://orange-management.com * @link http://orange-management.com
*/ */
namespace phpOMS\Stdlib\Map; namespace phpOMS\Stdlib\Map;
use phpOMS\Utils\Permutation; use phpOMS\Utils\Permutation;
/** /**

View File

@ -199,7 +199,14 @@ class PriorityQueue implements \Countable, \Serializable
} }
/** /**
* {@inheritdoc} * Unserialize queue.
*
* @param string $data Data to unserialze
*
* @return array
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/ */
public function unserialize($data) : array public function unserialize($data) : array
{ {

View File

@ -71,13 +71,15 @@ class Directory extends FileAbstract implements \Iterator, \ArrayAccess
if ($filename != ".." && $filename != ".") { if ($filename != ".." && $filename != ".") {
if (is_dir($dir . "/" . $filename) && $recursive) { if (is_dir($dir . "/" . $filename) && $recursive) {
$countSize += self::getFolderSize($dir . "/" . $filename, $recursive); $countSize += self::getFolderSize($dir . "/" . $filename, $recursive);
} else if (is_file($dir . "/" . $filename)) { } else {
if (is_file($dir . "/" . $filename)) {
$countSize += filesize($dir . "/" . $filename); $countSize += filesize($dir . "/" . $filename);
$count++; $count++;
} }
} }
} }
} }
}
return (int) $countSize; return (int) $countSize;
} }
@ -216,7 +218,7 @@ class Directory extends FileAbstract implements \Iterator, \ArrayAccess
parent::__construct($path); parent::__construct($path);
if (file_exists($this->path)) { if (file_exists($this->path)) {
parent::index(); $this->index();
} }
} }
@ -287,6 +289,7 @@ class Directory extends FileAbstract implements \Iterator, \ArrayAccess
$this->size -= $this->nodes[$name]->getSize(); $this->size -= $this->nodes[$name]->getSize();
unset($this->nodes[$name]); unset($this->nodes[$name]);
// todo: unlink??? // todo: unlink???
return true; return true;

View File

@ -26,7 +26,8 @@ namespace phpOMS\System;
* @link http://orange-management.com * @link http://orange-management.com
* @since 1.0.0 * @since 1.0.0
*/ */
final class OperatingSystem { final class OperatingSystem
{
/** /**
* Get OS. * Get OS.
* *

View File

@ -59,7 +59,7 @@ class SystemUtils
$mem = 0; $mem = 0;
while ($line = fgets($fh)) { while ($line = fgets($fh)) {
$pieces = array(); $pieces = [];
if (preg_match('/^MemTotal:\s+(\d+)\skB$/', $line, $pieces)) { if (preg_match('/^MemTotal:\s+(\d+)\skB$/', $line, $pieces)) {
$mem = $pieces[1] * 1024; $mem = $pieces[1] * 1024;
break; break;

View File

@ -2,23 +2,28 @@
class Aztec class Aztec
{ {
private function calculateSize() { private function calculateSize()
{
} }
private function bitStuffing() { private function bitStuffing()
{
} }
private function padding() { private function padding()
{
} }
private function check() { private function check()
{
} }
private function arange() { private function arange()
{
} }
} }

View File

@ -81,7 +81,7 @@ abstract class C128Abstract
/** /**
* Barcode dimension. * Barcode dimension.
* *
* @todo: Implement! * @todo : Implement!
* *
* @var int[] * @var int[]
* @since 1.0.0 * @since 1.0.0
@ -135,7 +135,7 @@ abstract class C128Abstract
* @param int $size Barcode height * @param int $size Barcode height
* @param int $orientation Orientation of the barcode * @param int $orientation Orientation of the barcode
* *
* @todo: add mirror parameter * @todo : add mirror parameter
* *
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn * @author Dennis Eichhorn

View File

@ -88,7 +88,7 @@ class C128a extends C128Abstract
* @param int $size Barcode height * @param int $size Barcode height
* @param int $orientation Orientation of the barcode * @param int $orientation Orientation of the barcode
* *
* @todo: add mirror parameter * @todo : add mirror parameter
* *
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn * @author Dennis Eichhorn
@ -103,7 +103,7 @@ class C128a extends C128Abstract
* *
* @param string $content Content to encrypt * @param string $content Content to encrypt
* *
* @todo: add mirror parameter * @todo : add mirror parameter
* *
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn * @author Dennis Eichhorn

View File

@ -71,7 +71,7 @@ class C25 extends C128Abstract
* @param int $size Barcode height * @param int $size Barcode height
* @param int $orientation Orientation of the barcode * @param int $orientation Orientation of the barcode
* *
* @todo: add mirror parameter * @todo : add mirror parameter
* *
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn * @author Dennis Eichhorn

View File

@ -70,7 +70,7 @@ class C39 extends C128Abstract
* @param int $size Barcode height * @param int $size Barcode height
* @param int $orientation Orientation of the barcode * @param int $orientation Orientation of the barcode
* *
* @todo: add mirror parameter * @todo : add mirror parameter
* *
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn * @author Dennis Eichhorn

View File

@ -71,7 +71,7 @@ class Codebar extends C128Abstract
* @param int $size Barcode height * @param int $size Barcode height
* @param int $orientation Orientation of the barcode * @param int $orientation Orientation of the barcode
* *
* @todo: add mirror parameter * @todo : add mirror parameter
* *
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn * @author Dennis Eichhorn
@ -110,10 +110,11 @@ class Codebar extends C128Abstract
for ($posX = 1; $posX <= $length; $posX++) { for ($posX = 1; $posX <= $length; $posX++) {
for ($posY = 0; $posY < $lenCodearr; $posY++) { for ($posY = 0; $posY < $lenCodearr; $posY++) {
if (substr($this->content, ($posX - 1), 1) == self::$CODEARRAY[$posY]) if (substr($this->content, ($posX - 1), 1) == self::$CODEARRAY[$posY]) {
$codeString .= self::$CODEARRAY2[$posY] . '1'; $codeString .= self::$CODEARRAY2[$posY] . '1';
} }
} }
}
return $codeString; return $codeString;
} }

View File

@ -47,9 +47,9 @@ class LZW implements CompressionInterface
$length = strlen($source); $length = strlen($source);
for ($i = 0; $i < $length; $i++) { for ($i = 0; $i < $length; $i++) {
$c = $source[$i]; $c = $source[$i];
$wc = $w.$c; $wc = $w . $c;
if (array_key_exists($w. $c, $dictionary)) { if (array_key_exists($w . $c, $dictionary)) {
$w = $w . $c; $w = $w . $c;
} else { } else {
array_push($result, $dictionary[$w]); array_push($result, $dictionary[$w]);
@ -59,10 +59,10 @@ class LZW implements CompressionInterface
} }
if ($w !== '') { if ($w !== '') {
array_push($result,$dictionary[$w]); array_push($result, $dictionary[$w]);
} }
return implode(',',$result); return implode(',', $result);
} }
/** /**
@ -83,14 +83,14 @@ class LZW implements CompressionInterface
$result = $w; $result = $w;
$count = count($compressed); $count = count($compressed);
for ($i = 1; $i < $count;$i++) { for ($i = 1; $i < $count; $i++) {
$k = $compressed[$i]; $k = $compressed[$i];
if ($dictionary[$k]) { if ($dictionary[$k]) {
$entry = $dictionary[$k]; $entry = $dictionary[$k];
} else { } else {
if ($k === $dictSize) { if ($k === $dictSize) {
$entry = $w.$w[0]; $entry = $w . $w[0];
} else { } else {
return null; return null;
} }

View File

@ -26,7 +26,8 @@ namespace phpOMS\Utils\Encoding;
* @link http://orange-management.com * @link http://orange-management.com
* @since 1.0.0 * @since 1.0.0
*/ */
class Caesar { class Caesar
{
/** /**
* ASCII lower char limit. * ASCII lower char limit.
* *
@ -50,16 +51,16 @@ class Caesar {
{ {
$result = ''; $result = '';
$length = strlen($source); $length = strlen($source);
$keyLength = strlen($key)-1; $keyLength = strlen($key) - 1;
for($i = 0, $j = 0; $i < $length; $i++, $j++) { for ($i = 0, $j = 0; $i < $length; $i++, $j++) {
if($j > $keyLength) { if ($j > $keyLength) {
$j = 0; $j = 0;
} }
$ascii = ord($source[$i]) + ord($key[$j]); $ascii = ord($source[$i]) + ord($key[$j]);
if($ascii > self::LIMIT_UPPER) { if ($ascii > self::LIMIT_UPPER) {
$ascii -= self::LIMIT_UPPER; $ascii -= self::LIMIT_UPPER;
} }
@ -76,16 +77,16 @@ class Caesar {
{ {
$result = ''; $result = '';
$length = strlen($raw); $length = strlen($raw);
$keyLength = strlen($key)-1; $keyLength = strlen($key) - 1;
for($i = 0, $j = 0; $i < $length; $i++, $j++) { for ($i = 0, $j = 0; $i < $length; $i++, $j++) {
if($j > $keyLength) { if ($j > $keyLength) {
$j = 0; $j = 0;
} }
$ascii = ord($raw[$i]) - ord($key[$j]); $ascii = ord($raw[$i]) - ord($key[$j]);
if($ascii < self::LIMIT_LOWER) { if ($ascii < self::LIMIT_LOWER) {
$ascii += self::LIMIT_LOWER; $ascii += self::LIMIT_LOWER;
} }

View File

@ -26,7 +26,8 @@ namespace phpOMS\Utils\Encoding;
* @link http://orange-management.com * @link http://orange-management.com
* @since 1.0.0 * @since 1.0.0
*/ */
final class Gray { final class Gray
{
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */

View File

@ -26,7 +26,8 @@ namespace phpOMS\Utils\Encoding;
* @link http://orange-management.com * @link http://orange-management.com
* @since 1.0.0 * @since 1.0.0
*/ */
final class XorEncoding { final class XorEncoding
{
/** /**
* {@inheritdoc} * {@inheritdoc}
@ -35,10 +36,10 @@ final class XorEncoding {
{ {
$result = ''; $result = '';
$length = strlen($source); $length = strlen($source);
$keyLength = strlen($key)-1; $keyLength = strlen($key) - 1;
for($i = 0, $j = 0; $i < $length; $i++, $j++) { for ($i = 0, $j = 0; $i < $length; $i++, $j++) {
if($j > $keyLength) { if ($j > $keyLength) {
$j = 0; $j = 0;
} }

View File

@ -25,6 +25,7 @@ require_once realpath(__DIR__ . '/../../../vendor/PHPExcel/Classes/PHPExcel.php'
* @package phpOMS\Utils\Excel * @package phpOMS\Utils\Excel
* @since 1.0.0 * @since 1.0.0
*/ */
/** @noinspection PhpUndefinedClassInspection */ /** @noinspection PhpUndefinedClassInspection */
class Excel extends \PHPExcel class Excel extends \PHPExcel
{ {

View File

@ -53,7 +53,7 @@ class Author
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com> * @author Dennis Eichhorn <d.eichhorn@oms.com>
*/ */
public function __construct(string $name, string $email) public function __construct(string $name = '', string $email = '')
{ {
$this->name = $name; $this->name = $name;
$this->email = $email; $this->email = $email;
@ -69,7 +69,7 @@ class Author
*/ */
public function getName() : string public function getName() : string
{ {
return $name; return $this->name;
} }
/** /**
@ -82,6 +82,6 @@ class Author
*/ */
public function getEmail() : string public function getEmail() : string
{ {
return $email; return $this->email;
} }
} }

View File

@ -44,7 +44,7 @@ class Branch
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com> * @author Dennis Eichhorn <d.eichhorn@oms.com>
*/ */
public function __construct(string $name) public function __construct(string $name = '')
{ {
$this->name = $name; $this->name = $name;
} }

View File

@ -14,7 +14,6 @@
* @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
@ -101,10 +100,11 @@ class Commit
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com> * @author Dennis Eichhorn <d.eichhorn@oms.com>
*/ */
public function __construct(string $id = '') { public function __construct(string $id = '')
$author = new Author(); {
$branch = new Branch(); $this->author = new Author();
$tag = new Tag(); $this->branch = new Branch();
$this->tag = new Tag();
if (!empty($id)) { if (!empty($id)) {
// todo: fill base info // todo: fill base info
@ -119,7 +119,8 @@ class Commit
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com> * @author Dennis Eichhorn <d.eichhorn@oms.com>
*/ */
public function addFile(string $path) { public function addFile(string $path)
{
if (!isset($this->files[$path])) { if (!isset($this->files[$path])) {
$this->files[$path] = []; $this->files[$path] = [];
} }
@ -247,7 +248,8 @@ class Commit
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com> * @author Dennis Eichhorn <d.eichhorn@oms.com>
*/ */
public function setBranch(Branch $branch) { public function setBranch(Branch $branch)
{
$this->branch = $branch; $this->branch = $branch;
} }
@ -272,7 +274,8 @@ class Commit
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com> * @author Dennis Eichhorn <d.eichhorn@oms.com>
*/ */
public function setTag(Tag $tag) { public function setTag(Tag $tag)
{
$this->tag = $tag; $this->tag = $tag;
} }

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; use phpOMS\System\File\PathException;
/** /**
@ -27,7 +28,8 @@ use phpOMS\System\File\PathException;
* @link http://orange-management.com * @link http://orange-management.com
* @since 1.0.0 * @since 1.0.0
*/ */
class Git { class Git
{
/** /**
* Git path. * Git 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; use phpOMS\System\File\PathException;
/** /**
@ -125,6 +126,8 @@ class Repository
* *
* @param string $cmd Command to run * @param string $cmd Command to run
* *
* @return string
*
* @throws \Exception * @throws \Exception
* *
* @since 1.0.0 * @since 1.0.0

View File

@ -0,0 +1,32 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright 2013 Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
namespace phpOMS\Utils\Git;
/**
* Gray encoding class
*
* @category Framework
* @package phpOMS\Asset
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @license OMS License 1.0
* @link http://orange-management.com
* @since 1.0.0
*/
class Tag
{
}

View File

@ -15,9 +15,13 @@
*/ */
namespace phpOMS\Utils\IO; namespace phpOMS\Utils\IO;
interface IODatabaseMapper { interface IODatabaseMapper
{
public function addSource(string $source); public function addSource(string $source);
public function setSources(array $sources); public function setSources(array $sources);
public function setLineBuffer(int $buffer); public function setLineBuffer(int $buffer);
public function insert(); public function insert();
} }

View File

@ -25,6 +25,7 @@ include __DIR__ . '/../../../Resources/tcpdf/tcpdf.php';
* @package phpOMS\Utils\Pdf * @package phpOMS\Utils\Pdf
* @since 1.0.0 * @since 1.0.0
*/ */
/** @noinspection PhpUndefinedClassInspection */ /** @noinspection PhpUndefinedClassInspection */
class Pdf extends \TCPDF class Pdf extends \TCPDF
{ {

File diff suppressed because it is too large Load Diff

View File

@ -58,7 +58,9 @@ class ClassParser
private $functions = []; private $functions = [];
public function __construct() {} public function __construct()
{
}
/** /**
* Saving class to file. * Saving class to file.
@ -154,7 +156,8 @@ class ClassParser
return false; return false;
} }
public function setName(string $name) { public function setName(string $name)
{
$this->name = $name; $this->name = $name;
} }

View File

@ -46,7 +46,8 @@ class FunctionParser
private $body = ''; private $body = '';
public function setName(string $name) { public function setName(string $name)
{
$this->name = $name; $this->name = $name;
} }
@ -55,7 +56,8 @@ class FunctionParser
return $this->name; return $this->name;
} }
public function seBody(string $body) { public function seBody(string $body)
{
$this->body = $body; $this->body = $body;
} }
@ -79,7 +81,8 @@ class FunctionParser
return $this->visibility; return $this->visibility;
} }
public function setStatic(bool $static) { public function setStatic(bool $static)
{
$this->isStatic = $static; $this->isStatic = $static;
} }

View File

@ -40,7 +40,8 @@ class MemberParser
private $default = null; private $default = null;
public function setName(string $name) { public function setName(string $name)
{
$this->name = $name; $this->name = $name;
} }
@ -59,7 +60,8 @@ class MemberParser
return $this->visibility; return $this->visibility;
} }
public function setStatic(bool $static) { public function setStatic(bool $static)
{
$this->isStatic = $static; $this->isStatic = $static;
if ($this->isStatic) { if ($this->isStatic) {
@ -81,7 +83,8 @@ class MemberParser
} }
} }
public function setDefault($default) { public function setDefault($default)
{
$this->default = $default; $this->default = $default;
} }

View File

@ -107,16 +107,16 @@ class Permutation
*/ */
public static function permutate($toPermute, array $key) public static function permutate($toPermute, array $key)
{ {
if(!is_array($toPermute) || !is_string($toPermute)) { if (!is_array($toPermute) || !is_string($toPermute)) {
throw new \Exception(); throw new \Exception();
} }
if(count($key) > strlen($toPermute)) { if (count($key) > strlen($toPermute)) {
throw new \Exception(); throw new \Exception();
} }
$i = 0; $i = 0;
foreach($key as $pos) { foreach ($key as $pos) {
$temp = $toPermute[$i]; $temp = $toPermute[$i];
$toPermute[$i] = $toPermute[$pos]; $toPermute[$i] = $toPermute[$pos];
$toPermute[$pos] = $temp; $toPermute[$pos] = $temp;

View File

@ -16,7 +16,6 @@
namespace phpOMS\Utils\RnG; namespace phpOMS\Utils\RnG;
/** /**
* File generator. * File generator.
* *

View File

@ -41,7 +41,7 @@ class LinearCongruentialGenerator
*/ */
public static function bsd(int $seed) public static function bsd(int $seed)
{ {
return function() use(&$seed) { return function () use (&$seed) {
return $seed = (1103515245 * $seed + 12345) % (1 << 31); return $seed = (1103515245 * $seed + 12345) % (1 << 31);
}; };
} }
@ -56,8 +56,9 @@ class LinearCongruentialGenerator
* @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 msvcrt(int $seed) { public static function msvcrt(int $seed)
return function() use (&$seed) { {
return function () use (&$seed) {
return ($seed = (214013 * $seed + 2531011) % (1 << 31)) >> 16; return ($seed = (214013 * $seed + 2531011) % (1 << 31)) >> 16;
}; };
} }

View File

@ -16,7 +16,6 @@
namespace phpOMS\Utils\RnG; namespace phpOMS\Utils\RnG;
/** /**
* Phone generator. * Phone generator.
* *

View File

@ -28,7 +28,8 @@ namespace phpOMS\Utils\TaskSchedule;
*/ */
class Cron implements ScheduleInterface class Cron implements ScheduleInterface
{ {
public function __construct() { public function __construct()
{
} }

View File

@ -208,7 +208,8 @@ class Interval
} }
public function setStart(\DateTime $start) { public function setStart(\DateTime $start)
{
$this->start = $start; $this->start = $start;
} }
@ -222,7 +223,8 @@ class Interval
return $this->end; return $this->end;
} }
public function setEnd(\DateTime $end) { public function setEnd(\DateTime $end)
{
$this->end = $end; $this->end = $end;
} }

View File

@ -5,10 +5,11 @@ namespace phpOMS\Utils\TaskSchedule;
use phpOMS\System\OperatingSystem; use phpOMS\System\OperatingSystem;
use phpOMS\System\SystemType; use phpOMS\System\SystemType;
final class SchedulerFactory { final class SchedulerFactory
{
public static function create() : ScheduleInterface public static function create() : ScheduleInterface
{ {
switch(OperatingSystem::getSystem()) { switch (OperatingSystem::getSystem()) {
case SystemType::WIN: case SystemType::WIN:
return new TaskScheduler(); return new TaskScheduler();
case SystemType::LINUX: case SystemType::LINUX:

View File

@ -5,10 +5,11 @@ namespace phpOMS\Utils\TaskSchedule;
use phpOMS\System\OperatingSystem; use phpOMS\System\OperatingSystem;
use phpOMS\System\SystemType; use phpOMS\System\SystemType;
final class TaskFactory { final class TaskFactory
{
public static function create(Interval $interval = null, string $cmd = '') : TaskInterface public static function create(Interval $interval = null, string $cmd = '') : TaskInterface
{ {
switch(OperatingSystem::getSystem()) { switch (OperatingSystem::getSystem()) {
case SystemType::WIN: case SystemType::WIN:
return new Schedule($interval, $cmd); return new Schedule($interval, $cmd);
case SystemType::LINUX: case SystemType::LINUX:

View File

@ -29,5 +29,6 @@ namespace phpOMS\Utils\TaskSchedule;
interface TaskInterface interface TaskInterface
{ {
public function setInterval(Interval $interval); public function setInterval(Interval $interval);
public function setCommand(string $command); public function setCommand(string $command);
} }

View File

@ -28,7 +28,8 @@ namespace phpOMS\Utils\TaskSchedule;
*/ */
class TaskScheduler implements ScheduleInterface class TaskScheduler implements ScheduleInterface
{ {
public function __construct() { public function __construct()
{
} }

View File

@ -16,7 +16,6 @@
namespace phpOMS\Validation; namespace phpOMS\Validation;
/** /**
* Validator abstract. * Validator abstract.
* *

View File

@ -16,7 +16,6 @@
namespace phpOMS\Validation; namespace phpOMS\Validation;
/** /**
* Validator abstract. * Validator abstract.
* *
@ -72,8 +71,10 @@ abstract class CreditCard extends ValidatorAbstract
return ($total % 10 == 0) ? true : false; return ($total % 10 == 0) ? true : false;
} }
public static function luhnTest(string $num) { public static function luhnTest(string $num)
{
$len = strlen($num); $len = strlen($num);
$sum = 0;
for ($i = $len - 1; $i >= 0; $i--) { for ($i = $len - 1; $i >= 0; $i--) {
$ord = ord($num[$i]); $ord = ord($num[$i]);

View File

@ -16,7 +16,6 @@
namespace phpOMS\Validation; namespace phpOMS\Validation;
/** /**
* Validator abstract. * Validator abstract.
* *

View File

@ -16,7 +16,6 @@
namespace phpOMS\Validation; namespace phpOMS\Validation;
/** /**
* Validator abstract. * Validator abstract.
* *

View File

@ -16,7 +16,6 @@
namespace phpOMS\Validation; namespace phpOMS\Validation;
/** /**
* Validator abstract. * Validator abstract.
* *

View File

@ -16,7 +16,6 @@
namespace phpOMS\Validation; namespace phpOMS\Validation;
/** /**
* Model validation trait. * Model validation trait.
* *

View File

@ -271,7 +271,7 @@ class View implements \Serializable
$data = include $path; $data = include $path;
$ob = ob_get_clean(); $ob = ob_get_clean();
if(is_array($data)) { if (is_array($data)) {
return $data; return $data;
} }
@ -354,7 +354,7 @@ class View implements \Serializable
$viewArray[] = $this->render(); $viewArray[] = $this->render();
foreach($this->views as $key => $view) { foreach ($this->views as $key => $view) {
$viewArray[$key] = $view->toArray(); $viewArray[$key] = $view->toArray();
} }
} }