php cs fixes

This commit is contained in:
Dennis Eichhorn 2019-04-27 10:34:00 +02:00
parent 4cdfab275e
commit c799124d12
489 changed files with 2114 additions and 682 deletions

View File

@ -178,11 +178,11 @@ class ApplicationAbstract
*/ */
public function __set($name, $value) : void public function __set($name, $value) : void
{ {
if (!empty($this->$name)) { if (!empty($this->{$name})) {
return; return;
} }
$this->$name = $value; $this->{$name} = $value;
} }
/** /**
@ -198,6 +198,6 @@ class ApplicationAbstract
*/ */
public function __get($name) public function __get($name)
{ {
return $this->$name; return $this->{$name};
} }
} }

View File

@ -69,11 +69,11 @@ final class NetPromoterScore
foreach ($this->scores as $score) { foreach ($this->scores as $score) {
if ($score > 8) { if ($score > 8) {
$promoters++; ++$promoters;
} elseif ($score > 6) { } elseif ($score > 6) {
$passives++; ++$passives;
} else { } else {
$detractors++; ++$detractors;
} }
} }

View File

@ -44,7 +44,7 @@ class ConnectionFactory
* *
* @return ConnectionInterface * @return ConnectionInterface
* *
* @throws \InvalidArgumentException Throws this exception if the cache is not supported. * @throws \InvalidArgumentException throws this exception if the cache is not supported
* *
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -46,7 +46,7 @@ final class ConnectionFactory
* *
* @return ConnectionAbstract * @return ConnectionAbstract
* *
* @throws \InvalidArgumentException Throws this exception if the database is not supported. * @throws \InvalidArgumentException throws this exception if the database is not supported
* *
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -2851,7 +2851,7 @@ class DataMapperAbstract implements DataMapperInterface
*/ */
private static function isInitialized(string $mapper, $id) : bool private static function isInitialized(string $mapper, $id) : bool
{ {
return isset(self::$initObjects[$mapper]) && isset(self::$initObjects[$mapper][$id]); return isset(self::$initObjects[$mapper], self::$initObjects[$mapper][$id]);
} }
/** /**
@ -2866,7 +2866,7 @@ class DataMapperAbstract implements DataMapperInterface
*/ */
private static function isInitializedArray(string $mapper, $id) : bool private static function isInitializedArray(string $mapper, $id) : bool
{ {
return isset(self::$initArrays[$mapper]) && isset(self::$initArrays[$mapper][$id]); return isset(self::$initArrays[$mapper], self::$initArrays[$mapper][$id]);
} }
/** /**

View File

@ -81,7 +81,7 @@ abstract class GrammarAbstract
* @since 1.0.0 * @since 1.0.0
*/ */
protected $specialKeywords = [ protected $specialKeywords = [
'COUNT(' 'COUNT(',
]; ];
/** /**

View File

@ -282,9 +282,9 @@ class Grammar extends GrammarAbstract
* @param mixed $value Value * @param mixed $value Value
* @param string $prefix Prefix in case value is a table * @param string $prefix Prefix in case value is a table
* *
* @return string Returns a string representation of the value. * @return string returns a string representation of the value
* *
* @throws \InvalidArgumentException Throws this exception if the value to compile is not supported by this function. * @throws \InvalidArgumentException throws this exception if the value to compile is not supported by this function
* *
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -57,7 +57,7 @@ class Grammar extends QueryGrammar
protected $createTablesComponents = [ protected $createTablesComponents = [
'createTable', 'createTable',
'createFields', 'createFields',
'createTableSettings' 'createTableSettings',
]; ];
/** /**
@ -134,7 +134,7 @@ class Grammar extends QueryGrammar
/** /**
* Compile drop query. * Compile drop query.
* *
* @param BuilderAbstract $query Query * @param BuilderAbstract $query Query
* @param string $table Tables to drop * @param string $table Tables to drop
* *
* @return string * @return string
@ -155,7 +155,7 @@ class Grammar extends QueryGrammar
/** /**
* Compile drop query. * Compile drop query.
* *
* @param BuilderAbstract $query Query * @param BuilderAbstract $query Query
* @param string $table Tables to drop * @param string $table Tables to drop
* *
* @return string * @return string

View File

@ -14,7 +14,6 @@ declare(strict_types=1);
namespace phpOMS\DataStorage\File; namespace phpOMS\DataStorage\File;
use phpOMS\DataStorage\File\QueryType;
use phpOMS\DataStorage\Database\Query\JoinType; use phpOMS\DataStorage\Database\Query\JoinType;
/** /**

View File

@ -19,8 +19,6 @@ declare(strict_types=1);
namespace phpOMS\DataStorage\File; namespace phpOMS\DataStorage\File;
use phpOMS\DataStorage\File\QueryType;
/** /**
* Json query JsonGrammar. * Json query JsonGrammar.
* *

View File

@ -70,7 +70,7 @@ class HttpSession implements SessionInterface
* @param bool|int|string $sid Session id * @param bool|int|string $sid Session id
* @param int $inactivityInterval Interval for session activity * @param int $inactivityInterval Interval for session activity
* *
* @throws LockException Throws this exception if the session is alrady locked for further interaction. * @throws LockException throws this exception if the session is alrady locked for further interaction
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -86,7 +86,7 @@ class HttpSession implements SessionInterface
$this->inactivityInterval = $inactivityInterval; $this->inactivityInterval = $inactivityInterval;
if (\session_status() !== PHP_SESSION_ACTIVE && !\headers_sent()) { if (\session_status() !== \PHP_SESSION_ACTIVE && !\headers_sent()) {
\session_set_cookie_params($liftetime, '/', '', false, true); \session_set_cookie_params($liftetime, '/', '', false, true);
\session_start(); \session_start();
} }

View File

@ -108,9 +108,9 @@ final class Dispatcher
* *
* @return array * @return array
* *
* @throws PathException This exception is thrown if the function cannot be autoloaded. * @throws PathException this exception is thrown if the function cannot be autoloaded
* @throws \Exception This exception is thrown if the function is not callable. * @throws \Exception this exception is thrown if the function is not callable
* @throws \UnexpectedValueException This exception is thrown if the controller string is malformed. * @throws \UnexpectedValueException this exception is thrown if the controller string is malformed
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -184,7 +184,7 @@ final class Dispatcher
* *
* @return object * @return object
* *
* @throws PathException This exception is thrown in case the controller couldn't be found. * @throws PathException this exception is thrown in case the controller couldn't be found
* *
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -65,7 +65,7 @@ final class EventManager implements \Countable
*/ */
public function __construct(Dispatcher $dispatcher = null) public function __construct(Dispatcher $dispatcher = null)
{ {
$this->dispatcher = $dispatcher ?? new class { $this->dispatcher = $dispatcher ?? new class() {
public function dispatch($func, ...$data) : void public function dispatch($func, ...$data) : void
{ {
$func(...$data); $func(...$data);
@ -140,7 +140,7 @@ final class EventManager implements \Countable
* @param string $id Sub-requirement for event * @param string $id Sub-requirement for event
* @param mixed $data Data to pass to the callback * @param mixed $data Data to pass to the callback
* *
* @return bool Returns true on sucessfully triggering the event, false if the event couldn't be triggered which also includes sub-requirements missing. * @return bool returns true on sucessfully triggering the event, false if the event couldn't be triggered which also includes sub-requirements missing
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -169,7 +169,7 @@ final class EventManager implements \Countable
* @param string $id Sub-requirement for event * @param string $id Sub-requirement for event
* @param mixed $data Data to pass to the callback * @param mixed $data Data to pass to the callback
* *
* @return bool Returns true on sucessfully triggering the event, false if the event couldn't be triggered which also includes sub-requirements missing. * @return bool returns true on sucessfully triggering the event, false if the event couldn't be triggered which also includes sub-requirements missing
* *
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -80,7 +80,7 @@ final class L11nManager
* *
* @return void * @return void
* *
* @throws \UnexpectedValueException This exception is thrown when no language definitions for the defined source `$from` exist. * @throws \UnexpectedValueException this exception is thrown when no language definitions for the defined source `$from` exist
* *
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -102,7 +102,7 @@ final class Money implements \Serializable
* *
* @return int * @return int
* *
* @throws \Exception This exception is thrown if an internal explode or substr error occurs. * @throws \Exception this exception is thrown if an internal explode or substr error occurs
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -189,7 +189,7 @@ final class Money implements \Serializable
* *
* @return string * @return string
* *
* @throws \Exception This exception is thrown if an internal substr error occurs. * @throws \Exception this exception is thrown if an internal substr error occurs
* *
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -248,8 +248,8 @@ final class FileLogger implements LoggerInterface
$replace['{level}'] = \sprintf('%--12s', $level); $replace['{level}'] = \sprintf('%--12s', $level);
$replace['{path}'] = $_SERVER['REQUEST_URI'] ?? 'REQUEST_URI'; $replace['{path}'] = $_SERVER['REQUEST_URI'] ?? 'REQUEST_URI';
$replace['{ip}'] = \sprintf('%--15s', $_SERVER['REMOTE_ADDR'] ?? '0.0.0.0'); $replace['{ip}'] = \sprintf('%--15s', $_SERVER['REMOTE_ADDR'] ?? '0.0.0.0');
$replace['{version}'] = \sprintf('%--15s', PHP_VERSION); $replace['{version}'] = \sprintf('%--15s', \PHP_VERSION);
$replace['{os}'] = \sprintf('%--15s', PHP_OS); $replace['{os}'] = \sprintf('%--15s', \PHP_OS);
$replace['{line}'] = \sprintf('%--15s', $context['line'] ?? '?'); $replace['{line}'] = \sprintf('%--15s', $context['line'] ?? '?');
return \strtr($message, $replace); return \strtr($message, $replace);
@ -277,10 +277,10 @@ final class FileLogger implements LoggerInterface
$this->fp = \fopen($this->path, 'a'); $this->fp = \fopen($this->path, 'a');
if ($this->fp !== false && \flock($this->fp, LOCK_EX)) { if ($this->fp !== false && \flock($this->fp, \LOCK_EX)) {
\fwrite($this->fp, $message . "\n"); \fwrite($this->fp, $message . "\n");
\fflush($this->fp); \fflush($this->fp);
\flock($this->fp, LOCK_UN); \flock($this->fp, \LOCK_UN);
\fclose($this->fp); \fclose($this->fp);
$this->fp = false; $this->fp = false;
} }
@ -406,11 +406,11 @@ final class FileLogger implements LoggerInterface
$levels[$line[1]] = 0; $levels[$line[1]] = 0;
} }
$levels[$line[1]]++; ++$levels[$line[1]];
$line = \fgetcsv($this->fp, 0, ';'); $line = \fgetcsv($this->fp, 0, ';');
} }
\fseek($this->fp, 0, SEEK_END); \fseek($this->fp, 0, \SEEK_END);
\fclose($this->fp); \fclose($this->fp);
return $levels; return $levels;
@ -453,11 +453,11 @@ final class FileLogger implements LoggerInterface
$connection[$line[2]] = 0; $connection[$line[2]] = 0;
} }
$connection[$line[2]]++; ++$connection[$line[2]];
$line = \fgetcsv($this->fp, 0, ';'); $line = \fgetcsv($this->fp, 0, ';');
} }
\fseek($this->fp, 0, SEEK_END); \fseek($this->fp, 0, \SEEK_END);
\fclose($this->fp); \fclose($this->fp);
\asort($connection); \asort($connection);
@ -493,10 +493,10 @@ final class FileLogger implements LoggerInterface
$line = \fgetcsv($this->fp, 0, ';'); $line = \fgetcsv($this->fp, 0, ';');
while ($line !== false && $line !== null) { while ($line !== false && $line !== null) {
$id++; ++$id;
if ($offset > 0) { if ($offset > 0) {
$offset--; --$offset;
continue; continue;
} }
@ -510,12 +510,12 @@ final class FileLogger implements LoggerInterface
} }
$logs[$id] = $line; $logs[$id] = $line;
$limit--; --$limit;
\ksort($logs); \ksort($logs);
$line = \fgetcsv($this->fp, 0, ';'); $line = \fgetcsv($this->fp, 0, ';');
} }
\fseek($this->fp, 0, SEEK_END); \fseek($this->fp, 0, \SEEK_END);
\fclose($this->fp); \fclose($this->fp);
return $logs; return $logs;
@ -548,7 +548,7 @@ final class FileLogger implements LoggerInterface
\fseek($this->fp, 0); \fseek($this->fp, 0);
while (($line = \fgetcsv($this->fp, 0, ';')) !== false && $current <= $id) { while (($line = \fgetcsv($this->fp, 0, ';')) !== false && $current <= $id) {
$current++; ++$current;
if ($current < $id) { if ($current < $id) {
continue; continue;
@ -567,7 +567,7 @@ final class FileLogger implements LoggerInterface
break; break;
} }
\fseek($this->fp, 0, SEEK_END); \fseek($this->fp, 0, \SEEK_END);
\fclose($this->fp); \fclose($this->fp);
return $log; return $log;

View File

@ -43,7 +43,7 @@ final class Gamma
*/ */
private const LANCZOSAPPROXIMATION = [ private const LANCZOSAPPROXIMATION = [
0.99999999999980993, 676.5203681218851, -1259.1392167224028, 771.32342877765313, -176.61502916214059, 0.99999999999980993, 676.5203681218851, -1259.1392167224028, 771.32342877765313, -176.61502916214059,
12.507343278686905, -0.13857109526572012, 9.9843695780195716e-6, 1.5056327351493116e-7 12.507343278686905, -0.13857109526572012, 9.9843695780195716e-6, 1.5056327351493116e-7,
]; ];
/** /**
@ -58,18 +58,18 @@ final class Gamma
public static function lanczosApproximationReal($z) : float public static function lanczosApproximationReal($z) : float
{ {
if ($z < 0.5) { if ($z < 0.5) {
return M_PI / (\sin(M_PI * $z) * self::lanczosApproximationReal(1 - $z)); return \M_PI / (\sin(\M_PI * $z) * self::lanczosApproximationReal(1 - $z));
} }
$z -= 1; --$z;
$a = self::LANCZOSAPPROXIMATION[0]; $a = self::LANCZOSAPPROXIMATION[0];
$t = $z + 7.5; $t = $z + 7.5;
for ($i = 1; $i < 9; ++$i) { for ($i = 1; $i < 9; ++$i) {
$a += self::LANCZOSAPPROXIMATION[$i] / ($z + $i); $a += self::LANCZOSAPPROXIMATION[$i] / ($z + $i);
} }
return \sqrt(2 * M_PI) * \pow($t, $z + 0.5) * \exp(-$t) * $a; return \sqrt(2 * \M_PI) * \pow($t, $z + 0.5) * \exp(-$t) * $a;
} }
/** /**
@ -83,7 +83,7 @@ final class Gamma
*/ */
public static function stirlingApproximation($x) : float public static function stirlingApproximation($x) : float
{ {
return \sqrt(2.0 * M_PI / $x) * \pow($x / M_E, $x); return \sqrt(2.0 * \M_PI / $x) * \pow($x / \M_E, $x);
} }
/** /**
@ -98,7 +98,7 @@ final class Gamma
public static function spougeApproximation($z) : float public static function spougeApproximation($z) : float
{ {
$k1_fact = 1.0; $k1_fact = 1.0;
$c = [\sqrt(2.0 * M_PI)]; $c = [\sqrt(2.0 * \M_PI)];
for ($k = 1; $k < 12; ++$k) { for ($k = 1; $k < 12; ++$k) {
$c[$k] = \exp(12 - $k) * \pow(12 - $k, $k - 0.5) / $k1_fact; $c[$k] = \exp(12 - $k) * \pow(12 - $k, $k - 0.5) / $k1_fact;

View File

@ -55,7 +55,7 @@ final class MonotoneChain
// Lower hull // Lower hull
for ($i = 0; $i < $n; ++$i) { for ($i = 0; $i < $n; ++$i) {
while ($k >= 2 && self::cross($result[$k - 2], $result[$k - 1], $points[$i]) <= 0) { while ($k >= 2 && self::cross($result[$k - 2], $result[$k - 1], $points[$i]) <= 0) {
$k--; --$k;
} }
$result[$k++] = $points[$i]; $result[$k++] = $points[$i];
@ -64,7 +64,7 @@ final class MonotoneChain
// Upper hull // Upper hull
for ($i = $n - 2, $t = $k + 1; $i >= 0; --$i) { for ($i = $n - 2, $t = $k + 1; $i >= 0; --$i) {
while ($k >= $t && self::cross($result[$k - 2], $result[$k - 1], $points[$i]) <= 0) { while ($k >= $t && self::cross($result[$k - 2], $result[$k - 1], $points[$i]) <= 0) {
$k--; --$k;
} }
$result[$k++] = $points[$i]; $result[$k++] = $points[$i];

View File

@ -36,7 +36,7 @@ final class Circle implements D2ShapeInterface
*/ */
public static function getSurface(float $r) : float public static function getSurface(float $r) : float
{ {
return \pi() * $r ** 2; return \M_PI * $r ** 2;
} }
/** /**
@ -50,7 +50,7 @@ final class Circle implements D2ShapeInterface
*/ */
public static function getPerimeter(float $r) : float public static function getPerimeter(float $r) : float
{ {
return 2 * \pi() * $r; return 2 * \M_PI * $r;
} }
/** /**
@ -64,7 +64,7 @@ final class Circle implements D2ShapeInterface
*/ */
public static function getRadiusBySurface(float $surface) : float public static function getRadiusBySurface(float $surface) : float
{ {
return \sqrt($surface / \pi()); return \sqrt($surface / \M_PI);
} }
/** /**
@ -81,6 +81,6 @@ final class Circle implements D2ShapeInterface
*/ */
public static function getRadiusByPerimeter(float $C) : float public static function getRadiusByPerimeter(float $C) : float
{ {
return $C / (2 * \pi()); return $C / (2 * \M_PI);
} }
} }

View File

@ -42,7 +42,7 @@ final class Ellipse implements D2ShapeInterface
*/ */
public static function getSurface(float $a, float $b) : float public static function getSurface(float $a, float $b) : float
{ {
return \pi() * $a * $b; return \M_PI * $a * $b;
} }
/** /**
@ -62,6 +62,6 @@ final class Ellipse implements D2ShapeInterface
*/ */
public static function getPerimeter(float $a, float $b) : float public static function getPerimeter(float $a, float $b) : float
{ {
return \pi() * ($a + $b) * (3 * ($a - $b) ** 2 / (($a + $b) ** 2 * (\sqrt(-3 * ($a - $b) ** 2 / (($a + $b) ** 2) + 4) + 10)) + 1); return \M_PI * ($a + $b) * (3 * ($a - $b) ** 2 / (($a + $b) ** 2 * (\sqrt(-3 * ($a - $b) ** 2 / (($a + $b) ** 2) + 4) + 10)) + 1);
} }
} }

View File

@ -126,7 +126,7 @@ final class Polygon implements D2ShapeInterface
} }
if (\abs($vertex1['x'] - $vertex2['x']) < self::EPSILON || $point['x'] < $xinters) { if (\abs($vertex1['x'] - $vertex2['x']) < self::EPSILON || $point['x'] < $xinters) {
$countIntersect++; ++$countIntersect;
} }
} }
} }

View File

@ -37,7 +37,7 @@ final class Cone implements D3ShapeInterface
*/ */
public static function getVolume(float $r, float $h) : float public static function getVolume(float $r, float $h) : float
{ {
return \pi() * $r ** 2 * $h / 3; return \M_PI * $r ** 2 * $h / 3;
} }
/** /**
@ -52,7 +52,7 @@ final class Cone implements D3ShapeInterface
*/ */
public static function getSurface(float $r, float $h) : float public static function getSurface(float $r, float $h) : float
{ {
return \pi() * $r * ($r + \sqrt($h ** 2 + $r ** 2)); return \M_PI * $r * ($r + \sqrt($h ** 2 + $r ** 2));
} }
/** /**
@ -85,6 +85,6 @@ final class Cone implements D3ShapeInterface
*/ */
public static function getHeightFromVolume(float $V, float $r) : float public static function getHeightFromVolume(float $V, float $r) : float
{ {
return 3 * $V / (\pi() * $r ** 2); return 3 * $V / (\M_PI * $r ** 2);
} }
} }

View File

@ -37,7 +37,7 @@ final class Cylinder implements D3ShapeInterface
*/ */
public static function getVolume(float $r, float $h) : float public static function getVolume(float $r, float $h) : float
{ {
return \pi() * $r ** 2 * $h; return \M_PI * $r ** 2 * $h;
} }
/** /**
@ -52,7 +52,7 @@ final class Cylinder implements D3ShapeInterface
*/ */
public static function getSurface(float $r, float $h) : float public static function getSurface(float $r, float $h) : float
{ {
return 2 * \pi() * ($r * $h + $r ** 2); return 2 * \M_PI * ($r * $h + $r ** 2);
} }
/** /**
@ -67,6 +67,6 @@ final class Cylinder implements D3ShapeInterface
*/ */
public static function getLateralSurface(float $r, float $h) : float public static function getLateralSurface(float $r, float $h) : float
{ {
return 2 * \pi() * $r * $h; return 2 * \M_PI * $r * $h;
} }
} }

View File

@ -116,7 +116,7 @@ final class Sphere implements D3ShapeInterface
*/ */
public static function getRadiusByVolume(float $v) : float public static function getRadiusByVolume(float $v) : float
{ {
return \pow($v * 3 / (4 * \pi()), 1 / 3); return \pow($v * 3 / (4 * \M_PI), 1 / 3);
} }
/** /**
@ -147,7 +147,7 @@ final class Sphere implements D3ShapeInterface
*/ */
public static function getRadiusBySurface(float $S) : float public static function getRadiusBySurface(float $S) : float
{ {
return \sqrt($S / (4 * \pi())); return \sqrt($S / (4 * \M_PI));
} }
/** /**
@ -173,7 +173,7 @@ final class Sphere implements D3ShapeInterface
*/ */
public static function getVolumeByRadius(float $r) : float public static function getVolumeByRadius(float $r) : float
{ {
return 4 / 3 * \pi() * $r ** 3; return 4 / 3 * \M_PI * $r ** 3;
} }
/** /**
@ -211,6 +211,6 @@ final class Sphere implements D3ShapeInterface
*/ */
public static function getSurfaceByRadius(float $r) : float public static function getSurfaceByRadius(float $r) : float
{ {
return 4 * \pi() * $r ** 2; return 4 * \M_PI * $r ** 2;
} }
} }

View File

@ -165,7 +165,7 @@ final class Integer
while (!Numbers::isSquare($b2) && $i < $limit) { while (!Numbers::isSquare($b2) && $i < $limit) {
++$i; ++$i;
$a += 1; ++$a;
$b2 = ($a * $a - $value); $b2 = ($a * $a - $value);
} }

View File

@ -90,7 +90,7 @@ final class Prime
while ($d % 2 == 0) { while ($d % 2 == 0) {
$d /= 2; $d /= 2;
$s++; ++$s;
} }
for ($i = 0; $i < $k; ++$i) { for ($i = 0; $i < $k; ++$i) {

View File

@ -37,7 +37,7 @@ class Evaluator
*/ */
public static function evaluate(string $equation) : ?float public static function evaluate(string $equation) : ?float
{ {
if (\preg_match('#[^0-9\+\-\*\/\(\)\ \^\.]#', $equation)) { if (\substr_count($equation, '(') !== \substr_count($equation, ')') || \preg_match('#[^0-9\+\-\*\/\(\)\ \^\.]#', $equation)) {
return null; return null;
} }
@ -106,7 +106,7 @@ class Evaluator
$output = []; $output = [];
$equation = \str_replace(' ', '', $equation); $equation = \str_replace(' ', '', $equation);
$equation = \preg_split('/([\+\-\*\/\^\(\)])/', $equation, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); $equation = \preg_split('/([\+\-\*\/\^\(\)])/', $equation, -1, \PREG_SPLIT_NO_EMPTY | \PREG_SPLIT_DELIM_CAPTURE);
if ($equation === false) { if ($equation === false) {
return []; return [];

View File

@ -17,9 +17,7 @@ use phpOMS\Math\Matrix\Matrix;
class MultipleLinearRegression class MultipleLinearRegression
{ {
/**
*
*/
public static function getRegression(array $x, array $y) : array public static function getRegression(array $x, array $y) : array
{ {
$X = new Matrix(\count($x), \count($x[0])); $X = new Matrix(\count($x), \count($x[0]));
@ -32,31 +30,23 @@ class MultipleLinearRegression
return $XT->mult($X)->inverse()->mult($XT)->mult($Y)->getMatrix(); return $XT->mult($X)->inverse()->mult($XT)->mult($Y)->getMatrix();
} }
/**
*
*/
public static function getVariance() : float public static function getVariance() : float
{ {
} }
/**
*
*/
public static function getPredictionInterval() : array public static function getPredictionInterval() : array
{ {
} }
/**
*
*/
public static function getSlope(float $b1, float $y, float $x) : float public static function getSlope(float $b1, float $y, float $x) : float
{ {
return 0.0; return 0.0;
} }
/**
*
*/
public static function getElasticity(float $b1, float $y, float $x): float public static function getElasticity(float $b1, float $y, float $x): float
{ {
return 0.0; return 0.0;

View File

@ -38,7 +38,7 @@ abstract class RegressionAbstract
* *
* @return array [b0 => ?, b1 => ?] * @return array [b0 => ?, b1 => ?]
* *
* @throws InvalidDimensionException Throws this exception if the dimension of both arrays is not equal. * @throws InvalidDimensionException throws this exception if the dimension of both arrays is not equal
* *
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -37,7 +37,7 @@ class CauchyDistribution
*/ */
public static function getPdf(float $x, float $x0, float $gamma) : float public static function getPdf(float $x, float $x0, float $gamma) : float
{ {
return 1 / (\pi() * $gamma * (1 + (($x - $x0) / $gamma) ** 2)); return 1 / (\M_PI * $gamma * (1 + (($x - $x0) / $gamma) ** 2));
} }
/** /**
@ -53,7 +53,7 @@ class CauchyDistribution
*/ */
public static function getCdf(float $x, float $x0, float $gamma) : float public static function getCdf(float $x, float $x0, float $gamma) : float
{ {
return 1 / \pi() * \atan(($x - $x0) / $gamma) + 0.5; return 1 / \M_PI * \atan(($x - $x0) / $gamma) + 0.5;
} }
/** /**
@ -95,6 +95,6 @@ class CauchyDistribution
*/ */
public static function getEntropy(float $gamma) : float public static function getEntropy(float $gamma) : float
{ {
return \log(4 * M_PI * $gamma); return \log(4 * \M_PI * $gamma);
} }
} }

View File

@ -120,7 +120,7 @@ class ChiSquaredDistribution
'Chi2' => $sum, 'Chi2' => $sum,
'P' => $p, 'P' => $p,
'H0' => ($p > $significance), 'H0' => ($p > $significance),
'df' => $df 'df' => $df,
]; ];
} }

View File

@ -38,7 +38,7 @@ class NormalDistribution
*/ */
public static function getPdf(float $x, float $mu, float $sig) : float public static function getPdf(float $x, float $mu, float $sig) : float
{ {
return 1 / ($sig * \sqrt(2 * \pi())) * \exp(-($x - $mu) ** 2 / (2 * $sig ** 2)); return 1 / ($sig * \sqrt(2 * \M_PI)) * \exp(-($x - $mu) ** 2 / (2 * $sig ** 2));
} }
/** /**
@ -72,9 +72,9 @@ class NormalDistribution
return -self::erf(-$x); return -self::erf(-$x);
} }
$a = 8 * (\pi() - 3) / (3 * \pi() * (4 - \pi())); $a = 8 * (\M_PI - 3) / (3 * \M_PI * (4 - \M_PI));
return \sqrt(1 - \exp(-($x ** 2) * (4 / \pi() + $a * $x ** 2) / (1 + $a * $x ** 2))); return \sqrt(1 - \exp(-($x ** 2) * (4 / \M_PI + $a * $x ** 2) / (1 + $a * $x ** 2)));
} }
/** /**

View File

@ -109,7 +109,7 @@ final class Request extends RequestAbstract
public function getOS() : string public function getOS() : string
{ {
if ($this->os === null) { if ($this->os === null) {
$this->os = \strtolower(PHP_OS); $this->os = \strtolower(\PHP_OS);
} }
return $this->os; return $this->os;

View File

@ -120,7 +120,7 @@ final class Response extends ResponseAbstract implements RenderableInterface
* *
* @return string * @return string
* *
* @throws \Exception This exception is thrown if the response cannot be rendered. * @throws \Exception this exception is thrown if the response cannot be rendered
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -129,7 +129,7 @@ final class Response extends ResponseAbstract implements RenderableInterface
$render = ''; $render = '';
foreach ($this->response as $key => $response) { foreach ($this->response as $key => $response) {
if ($response instanceOf \Serializable) { if ($response instanceof \Serializable) {
$render .= $response->serialize(); $render .= $response->serialize();
} elseif (\is_string($response) || \is_numeric($response)) { } elseif (\is_string($response) || \is_numeric($response)) {
$render .= $response; $render .= $response;

View File

@ -96,7 +96,7 @@ final class Request extends RequestAbstract
$this->setupUriBuilder(); $this->setupUriBuilder();
} }
$this->data = \array_change_key_case($this->data, CASE_LOWER); $this->data = \array_change_key_case($this->data, \CASE_LOWER);
} }
/** /**
@ -479,7 +479,7 @@ final class Request extends RequestAbstract
{ {
if ($this->getMethod() === RequestMethod::GET && !empty($this->data)) { if ($this->getMethod() === RequestMethod::GET && !empty($this->data)) {
return $this->uri->__toString() return $this->uri->__toString()
. (\parse_url($this->uri->__toString(), PHP_URL_QUERY) ? '&' : '?') . (\parse_url($this->uri->__toString(), \PHP_URL_QUERY) ? '&' : '?')
. \http_build_query($this->data); . \http_build_query($this->data);
} }

View File

@ -32,7 +32,7 @@ final class Rest
* *
* @return string Returns the request result * @return string Returns the request result
* *
* @throws \Exception This exception is thrown if an internal curl_init error occurs. * @throws \Exception this exception is thrown if an internal curl_init error occurs
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -44,36 +44,36 @@ final class Rest
throw new \Exception('Internal curl_init error.'); // @codeCoverageIgnore throw new \Exception('Internal curl_init error.'); // @codeCoverageIgnore
} }
\curl_setopt($curl, CURLOPT_NOBODY, true); \curl_setopt($curl, \CURLOPT_NOBODY, true);
\curl_setopt($curl, CURLOPT_HEADER, false); \curl_setopt($curl, \CURLOPT_HEADER, false);
switch ($request->getMethod()) { switch ($request->getMethod()) {
case RequestMethod::GET: case RequestMethod::GET:
\curl_setopt($curl, CURLOPT_HTTPGET, true); \curl_setopt($curl, \CURLOPT_HTTPGET, true);
break; break;
case RequestMethod::PUT: case RequestMethod::PUT:
\curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PUT'); \curl_setopt($curl, \CURLOPT_CUSTOMREQUEST, 'PUT');
break; break;
case RequestMethod::DELETE: case RequestMethod::DELETE:
\curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'DELETE'); \curl_setopt($curl, \CURLOPT_CUSTOMREQUEST, 'DELETE');
break; break;
} }
if ($request->getMethod() !== RequestMethod::GET) { if ($request->getMethod() !== RequestMethod::GET) {
\curl_setopt($curl, CURLOPT_POST, 1); \curl_setopt($curl, \CURLOPT_POST, 1);
if ($request->getData() !== null) { if ($request->getData() !== null) {
\curl_setopt($curl, CURLOPT_POSTFIELDS, $request->getData()); \curl_setopt($curl, \CURLOPT_POSTFIELDS, $request->getData());
} }
} }
if ($request->getUri()->getUser() !== '') { if ($request->getUri()->getUser() !== '') {
\curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); \curl_setopt($curl, \CURLOPT_HTTPAUTH, \CURLAUTH_BASIC);
\curl_setopt($curl, CURLOPT_USERPWD, $request->getUri()->getUserInfo()); \curl_setopt($curl, \CURLOPT_USERPWD, $request->getUri()->getUserInfo());
} }
\curl_setopt($curl, CURLOPT_URL, $request->__toString()); \curl_setopt($curl, \CURLOPT_URL, $request->__toString());
\curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); \curl_setopt($curl, \CURLOPT_RETURNTRANSFER, 1);
$result = \curl_exec($curl); $result = \curl_exec($curl);

View File

@ -89,10 +89,10 @@ class EmailAbstract
$this->timeout = $timeout; $this->timeout = $timeout;
$this->ssl = $ssl; $this->ssl = $ssl;
\imap_timeout(IMAP_OPENTIMEOUT, $timeout); \imap_timeout(\IMAP_OPENTIMEOUT, $timeout);
\imap_timeout(IMAP_READTIMEOUT, $timeout); \imap_timeout(\IMAP_READTIMEOUT, $timeout);
\imap_timeout(IMAP_WRITETIMEOUT, $timeout); \imap_timeout(\IMAP_WRITETIMEOUT, $timeout);
\imap_timeout(IMAP_CLOSETIMEOUT, $timeout); \imap_timeout(\IMAP_CLOSETIMEOUT, $timeout);
} }
/** /**
@ -259,7 +259,7 @@ class EmailAbstract
*/ */
public function getInboxOverview(string $option = 'ALL') : array public function getInboxOverview(string $option = 'ALL') : array
{ {
$ids = \imap_search($this->con, $option, SE_FREE, 'UTF-8'); $ids = \imap_search($this->con, $option, \SE_FREE, 'UTF-8');
return \is_array($ids) ? \imap_fetch_overview($this->con, \implode(',', $ids)) : []; return \is_array($ids) ? \imap_fetch_overview($this->con, \implode(',', $ids)) : [];
} }

View File

@ -115,7 +115,7 @@ class FormValidation implements \Serializable, ArrayableInterface, \JsonSerializ
{ {
return [ return [
'type' => self::TYPE, 'type' => self::TYPE,
'validation' => $this->validation 'validation' => $this->validation,
]; ];
} }
} }

View File

@ -165,7 +165,7 @@ class Redirect implements \Serializable, ArrayableInterface, \JsonSerializable
'type' => self::TYPE, 'type' => self::TYPE,
'time' => $this->delay, 'time' => $this->delay,
'uri' => $this->uri, 'uri' => $this->uri,
'new' => $this->new 'new' => $this->new,
]; ];
} }
} }

View File

@ -114,7 +114,7 @@ class Reload implements \Serializable, ArrayableInterface, \JsonSerializable
{ {
return [ return [
'type' => self::TYPE, 'type' => self::TYPE,
'time' => $this->delay 'time' => $this->delay,
]; ];
} }

View File

@ -75,7 +75,7 @@ final class InfoManager
* *
* @return void * @return void
* *
* @throws PathException This exception is thrown in case the info file path doesn't exist. * @throws PathException this exception is thrown in case the info file path doesn't exist
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -103,7 +103,7 @@ final class InfoManager
throw new PathException($this->path); throw new PathException($this->path);
} }
\file_put_contents($this->path, \json_encode($this->info, JSON_PRETTY_PRINT)); \file_put_contents($this->path, \json_encode($this->info, \JSON_PRETTY_PRINT));
} }
/** /**

View File

@ -218,7 +218,7 @@ abstract class InstallerAbstract
$appRoutes = \array_merge_recursive($appRoutes, $moduleRoutes); $appRoutes = \array_merge_recursive($appRoutes, $moduleRoutes);
\file_put_contents($destRoutePath, '<?php return ' . ArrayParser::serializeArray($appRoutes) . ';', LOCK_EX); \file_put_contents($destRoutePath, '<?php return ' . ArrayParser::serializeArray($appRoutes) . ';', \LOCK_EX);
} }
/** /**
@ -284,6 +284,6 @@ abstract class InstallerAbstract
$appHooks = \array_merge_recursive($appHooks, $moduleHooks); $appHooks = \array_merge_recursive($appHooks, $moduleHooks);
\file_put_contents($destHookPath, '<?php return ' . ArrayParser::serializeArray($appHooks) . ';', LOCK_EX); \file_put_contents($destHookPath, '<?php return ' . ArrayParser::serializeArray($appHooks) . ';', \LOCK_EX);
} }
} }

View File

@ -248,7 +248,7 @@ final class ModuleManager
{ {
if (empty($this->all)) { if (empty($this->all)) {
\chdir($this->modulePath); \chdir($this->modulePath);
$files = \glob('*', GLOB_ONLYDIR); $files = \glob('*', \GLOB_ONLYDIR);
$c = \count($files); $c = \count($files);
for ($i = 0; $i < $c; ++$i) { for ($i = 0; $i < $c; ++$i) {

View File

@ -109,7 +109,7 @@ final class PackageManager
* *
* @return void * @return void
* *
* @throws PathException This exception is thrown in case the info file path doesn't exist. * @throws PathException this exception is thrown in case the info file path doesn't exist
* *
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -14,8 +14,8 @@ declare(strict_types=1);
namespace phpOMS\Router; namespace phpOMS\Router;
use phpOMS\Message\RequestAbstract;
use phpOMS\Message\Http\Request; use phpOMS\Message\Http\Request;
use phpOMS\Message\RequestAbstract;
use phpOMS\Uri\Http; use phpOMS\Uri\Http;
/** /**

View File

@ -74,7 +74,7 @@ class Client extends SocketAbstract
while ($this->run) { while ($this->run) {
try { try {
$i++; ++$i;
$msg = 'disconnect'; $msg = 'disconnect';
\socket_write($this->sock, $msg, \strlen($msg)); \socket_write($this->sock, $msg, \strlen($msg));

View File

@ -64,7 +64,7 @@ class CommandManager implements \Countable
public function attach(string $cmd, $callback, $source) : void public function attach(string $cmd, $callback, $source) : void
{ {
$this->commands[$cmd] = [$callback, $source]; $this->commands[$cmd] = [$callback, $source];
$this->count++; ++$this->count;
} }
/** /**
@ -81,7 +81,7 @@ class CommandManager implements \Countable
{ {
if (\array_key_exists($cmd, $this->commands)) { if (\array_key_exists($cmd, $this->commands)) {
unset($this->commands[$cmd]); unset($this->commands[$cmd]);
$this->count--; --$this->count;
} }
} }

View File

@ -159,7 +159,7 @@ class Server extends SocketAbstract
$upgrade = "HTTP/1.1 101 Switching Protocols\r\n" . $upgrade = "HTTP/1.1 101 Switching Protocols\r\n" .
"Upgrade: websocket\r\n" . "Upgrade: websocket\r\n" .
"Connection: Upgrade\r\n" . "Connection: Upgrade\r\n" .
"Sec-WebSocket-Accept: $acceptKey" . "Sec-WebSocket-Accept: ${acceptKey}" .
"\r\n\r\n"; "\r\n\r\n";
\socket_write($client->getSocket(), $upgrade); \socket_write($client->getSocket(), $upgrade);
$client->setHandshake(true); $client->setHandshake(true);

View File

@ -66,7 +66,7 @@ abstract class SocketAbstract implements SocketInterface
$this->port = $port; $this->port = $port;
// todo: if local network connect use AF_UNIX // todo: if local network connect use AF_UNIX
$this->sock = \socket_create(AF_INET, SOCK_STREAM, SOL_TCP); $this->sock = \socket_create(\AF_INET, \SOCK_STREAM, \SOL_TCP);
} }
/** /**

View File

@ -81,7 +81,7 @@ abstract class Enum
* *
* @return mixed * @return mixed
* *
* @throws \UnexpectedValueException Throws this exception if the constant is not defined in the enum class. * @throws \UnexpectedValueException throws this exception if the constant is not defined in the enum class
* *
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -70,7 +70,7 @@ class SmartDateTime extends \DateTime
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public function createModify(int $y, int $m = 0, int $d = 0, int $calendar = CAL_GREGORIAN) : self public function createModify(int $y, int $m = 0, int $d = 0, int $calendar = \CAL_GREGORIAN) : self
{ {
$dt = clone $this; $dt = clone $this;
$dt->smartModify($y, $m, $d, $calendar); $dt->smartModify($y, $m, $d, $calendar);
@ -90,7 +90,7 @@ class SmartDateTime extends \DateTime
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public function smartModify(int $y, int $m = 0, int $d = 0, int $calendar = CAL_GREGORIAN) : self public function smartModify(int $y, int $m = 0, int $d = 0, int $calendar = \CAL_GREGORIAN) : self
{ {
$yearChange = (int) \floor(((int) $this->format('m') - 1 + $m) / 12); $yearChange = (int) \floor(((int) $this->format('m') - 1 + $m) / 12);
$yearChange = ((int) $this->format('m') - 1 + $m) < 0 && ((int) $this->format('m') - 1 + $m) % 12 === 0 ? $yearChange - 1 : $yearChange; $yearChange = ((int) $this->format('m') - 1 + $m) < 0 && ((int) $this->format('m') - 1 + $m) % 12 === 0 ? $yearChange - 1 : $yearChange;

View File

@ -161,7 +161,7 @@ final class FileUtils
} elseif ($permission[$i] === 'w') { } elseif ($permission[$i] === 'w') {
$tempPermission += 2; $tempPermission += 2;
} elseif ($permission[$i] === 'x') { } elseif ($permission[$i] === 'x') {
$tempPermission += 1; ++$tempPermission;
} }
if (($i + 1) % 3 === 0) { if (($i + 1) % 3 === 0) {

View File

@ -18,7 +18,6 @@ use phpOMS\System\File\ContainerInterface;
use phpOMS\System\File\DirectoryInterface; use phpOMS\System\File\DirectoryInterface;
use phpOMS\System\File\FileUtils; use phpOMS\System\File\FileUtils;
use phpOMS\System\File\Local\Directory as LocalDirectory; use phpOMS\System\File\Local\Directory as LocalDirectory;
use phpOMS\System\File\Local\File as LocalFile;
use phpOMS\System\File\PathException; use phpOMS\System\File\PathException;
use phpOMS\Uri\Http; use phpOMS\Uri\Http;
@ -362,9 +361,9 @@ class Directory extends FileAbstract implements FtpContainerInterface, Directory
/** /**
* Download file. * Download file.
* *
* @param resource $con FTP connection * @param resource $con FTP connection
* @param string $from Path of the resource to copy * @param string $from Path of the resource to copy
* @param string $to Path of the resource to copy to * @param string $to Path of the resource to copy to
* *
* @return bool True on success and false on failure * @return bool True on success and false on failure
* *
@ -395,9 +394,9 @@ class Directory extends FileAbstract implements FtpContainerInterface, Directory
/** /**
* Upload file. * Upload file.
* *
* @param resource $con FTP connection * @param resource $con FTP connection
* @param string $from Path of the resource to copy * @param string $from Path of the resource to copy
* @param string $to Path of the resource to copy to * @param string $to Path of the resource to copy to
* *
* @return bool True on success and false on failure * @return bool True on success and false on failure
* *
@ -638,7 +637,7 @@ class Directory extends FileAbstract implements FtpContainerInterface, Directory
* @param mixed $offset <p> * @param mixed $offset <p>
* The offset to retrieve. * The offset to retrieve.
* </p> * </p>
* @return mixed Can return all value types. * @return mixed can return all value types
* @since 5.0.0 * @since 5.0.0
*/ */
public function offsetGet($offset) public function offsetGet($offset)

View File

@ -135,7 +135,7 @@ class File extends FileAbstract implements FileInterface
\file_put_contents($tmpFile, $content); \file_put_contents($tmpFile, $content);
} }
\ftp_put($con, $path, $tmpFile, FTP_BINARY); \ftp_put($con, $path, $tmpFile, \FTP_BINARY);
\ftp_chmod($con, 0755, $path); \ftp_chmod($con, 0755, $path);
\unlink($tmpFile); \unlink($tmpFile);
@ -157,7 +157,7 @@ class File extends FileAbstract implements FileInterface
$temp = \fopen('php://temp', 'r+'); $temp = \fopen('php://temp', 'r+');
$content = ''; $content = '';
if (\ftp_fget($con, $temp, $path, FTP_BINARY, 0)) { if (\ftp_fget($con, $temp, $path, \FTP_BINARY, 0)) {
\rewind($temp); \rewind($temp);
$content = \stream_get_contents($temp); $content = \stream_get_contents($temp);
} }
@ -276,9 +276,9 @@ class File extends FileAbstract implements FileInterface
/** /**
* Gets the directory name of a file. * Gets the directory name of a file.
* *
* @param string $path Path of the file to get the directory name for. * @param string $path path of the file to get the directory name for
* *
* @return string Returns the directory name of the file. * @return string returns the directory name of the file
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -290,9 +290,9 @@ class File extends FileAbstract implements FileInterface
/** /**
* Gets the directory path of a file. * Gets the directory path of a file.
* *
* @param string $path Path of the file to get the directory name for. * @param string $path path of the file to get the directory name for
* *
* @return string Returns the directory name of the file. * @return string returns the directory name of the file
* *
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -143,7 +143,7 @@ interface FtpContainerInterface
/** /**
* Check existence of resource. * Check existence of resource.
* *
* @param resource $con FTP connection * @param resource $con FTP connection
* @param string $path Path of the resource * @param string $path Path of the resource
* *
* @return bool * @return bool

View File

@ -136,7 +136,7 @@ final class Directory extends FileAbstract implements LocalContainerInterface, D
{ {
parent::index(); parent::index();
foreach (\glob($this->path . DIRECTORY_SEPARATOR . $this->filter) as $filename) { foreach (\glob($this->path . \DIRECTORY_SEPARATOR . $this->filter) as $filename) {
if (!StringUtils::endsWith(\trim($filename), '.')) { if (!StringUtils::endsWith(\trim($filename), '.')) {
$file = \is_dir($filename) ? new self($filename) : new File($filename); $file = \is_dir($filename) ? new self($filename) : new File($filename);

View File

@ -284,9 +284,9 @@ final class File extends FileAbstract implements LocalContainerInterface, FileIn
/** /**
* Gets the directory name of a file. * Gets the directory name of a file.
* *
* @param string $path Path of the file to get the directory name for. * @param string $path path of the file to get the directory name for
* *
* @return string Returns the directory name of the file. * @return string returns the directory name of the file
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -298,9 +298,9 @@ final class File extends FileAbstract implements LocalContainerInterface, FileIn
/** /**
* Gets the directory path of a file. * Gets the directory path of a file.
* *
* @param string $path Path of the file to get the directory name for. * @param string $path path of the file to get the directory name for
* *
* @return string Returns the directory name of the file. * @return string returns the directory name of the file
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -366,7 +366,7 @@ final class File extends FileAbstract implements LocalContainerInterface, FileIn
/** /**
* Gets the directory name of a file. * Gets the directory name of a file.
* *
* @return string Returns the directory name of the file. * @return string returns the directory name of the file
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -378,7 +378,7 @@ final class File extends FileAbstract implements LocalContainerInterface, FileIn
/** /**
* Gets the directory path of a file. * Gets the directory path of a file.
* *
* @return string Returns the directory path of the file. * @return string returns the directory path of the file
* *
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -37,7 +37,7 @@ abstract class StorageAbstract
/** /**
* Get instance. * Get instance.
* *
* @return StorageAbstract Storage instance. * @return StorageAbstract storage instance
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -57,7 +57,7 @@ abstract class StorageAbstract
/** /**
* Get storage type. * Get storage type.
* *
* @return int Storage type. * @return int storage type
* *
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -43,11 +43,11 @@ final class OperatingSystem
*/ */
public static function getSystem() : int public static function getSystem() : int
{ {
if (\stristr(PHP_OS, 'DAR') !== false) { if (\stristr(\PHP_OS, 'DAR') !== false) {
return SystemType::OSX; return SystemType::OSX;
} elseif (\stristr(PHP_OS, 'WIN') !== false) { } elseif (\stristr(\PHP_OS, 'WIN') !== false) {
return SystemType::WIN; return SystemType::WIN;
} elseif (\stristr(PHP_OS, 'LINUX') !== false) { } elseif (\stristr(\PHP_OS, 'LINUX') !== false) {
return SystemType::LINUX; return SystemType::LINUX;
} }

View File

@ -46,12 +46,12 @@ final class SystemUtils
{ {
$mem = 0; $mem = 0;
if (\stristr(PHP_OS, 'WIN')) { if (\stristr(\PHP_OS, 'WIN')) {
$memArr = []; $memArr = [];
\exec('wmic memorychip get capacity', $memArr); \exec('wmic memorychip get capacity', $memArr);
$mem = \array_sum($memArr) / 1024; $mem = \array_sum($memArr) / 1024;
} elseif (\stristr(PHP_OS, 'LINUX')) { } elseif (\stristr(\PHP_OS, 'LINUX')) {
$fh = \fopen('/proc/meminfo', 'r'); $fh = \fopen('/proc/meminfo', 'r');
if ($fh === false) { if ($fh === false) {
@ -83,7 +83,7 @@ final class SystemUtils
{ {
$memUsage = 0; $memUsage = 0;
if (\stristr(PHP_OS, 'LINUX')) { if (\stristr(\PHP_OS, 'LINUX')) {
$free = \shell_exec('free'); $free = \shell_exec('free');
if ($free === null) { if ($free === null) {
@ -111,11 +111,11 @@ final class SystemUtils
{ {
$cpuUsage = 0; $cpuUsage = 0;
if (\stristr(PHP_OS, 'WIN') !== false) { if (\stristr(\PHP_OS, 'WIN') !== false) {
$cpuUsage = null; $cpuUsage = null;
\exec('wmic cpu get LoadPercentage', $cpuUsage); \exec('wmic cpu get LoadPercentage', $cpuUsage);
$cpuUsage = $cpuUsage[1]; $cpuUsage = $cpuUsage[1];
} elseif (\stristr(PHP_OS, 'LINUX') !== false) { } elseif (\stristr(\PHP_OS, 'LINUX') !== false) {
$cpuUsage = \sys_getloadavg()[0] * 100; $cpuUsage = \sys_getloadavg()[0] * 100;
} }

View File

@ -191,7 +191,7 @@ final class Http implements UriInterface
\parse_str($this->queryString, $this->query); \parse_str($this->queryString, $this->query);
} }
$this->query = \array_change_key_case($this->query, CASE_LOWER); $this->query = \array_change_key_case($this->query, \CASE_LOWER);
$this->fragment = $url['fragment'] ?? ''; $this->fragment = $url['fragment'] ?? '';
$this->base = $this->scheme . '://' . $this->host . ($this->port !== 80 ? ':' . $this->port : '') . $this->rootPath; $this->base = $this->scheme . '://' . $this->host . ($this->port !== 80 ? ':' . $this->port : '') . $this->rootPath;
@ -230,7 +230,7 @@ final class Http implements UriInterface
*/ */
public static function isValid(string $uri) : bool public static function isValid(string $uri) : bool
{ {
return (bool) \filter_var($uri, FILTER_VALIDATE_URL); return (bool) \filter_var($uri, \FILTER_VALIDATE_URL);
} }
/** /**

View File

@ -307,7 +307,7 @@ abstract class C128Abstract
$checksum += $values[$activeKey] * $pos; $checksum += $values[$activeKey] * $pos;
} }
$codeString .= static::$CODEARRAY[$keys[($checksum - (\intval($checksum / 103) * 103))]]; $codeString .= static::$CODEARRAY[$keys[($checksum - ((int) ($checksum / 103) * 103))]];
return $codeString; return $codeString;
} }

View File

@ -100,10 +100,10 @@ class C128c extends C128Abstract
$codeString .= self::$CODEARRAY[$activeKey]; $codeString .= self::$CODEARRAY[$activeKey];
$checksum += $values[$activeKey] * $checkPos; $checksum += $values[$activeKey] * $checkPos;
$checkPos++; ++$checkPos;
} }
$codeString .= self::$CODEARRAY[$keys[($checksum - (\intval($checksum / 103) * 103))]]; $codeString .= self::$CODEARRAY[$keys[($checksum - ((int) ($checksum / 103) * 103))]];
return $codeString; return $codeString;
} }

View File

@ -69,7 +69,7 @@ class C25 extends C128Abstract
* *
* @return void * @return void
* *
* @throws \InvalidArgumentException This exception is thrown if the content string is not supported. * @throws \InvalidArgumentException this exception is thrown if the content string is not supported
* *
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -35,7 +35,7 @@ class LZW implements CompressionInterface
$result = []; $result = [];
$dictSize = 256; $dictSize = 256;
for ($i = 0; $i < 256; $i += 1) { for ($i = 0; $i < 256; ++$i) {
$dictionary[\chr($i)] = $i; $dictionary[\chr($i)] = $i;
} }

View File

@ -34,7 +34,7 @@ class Numeric
public const ROMANS = [ public const ROMANS = [
'M' => 1000, 'CM' => 900, 'D' => 500, 'CD' => 400, 'C' => 100, 'M' => 1000, 'CM' => 900, 'D' => 500, 'CD' => 400, 'C' => 100,
'XC' => 90, 'L' => 50, 'XL' => 40, 'X' => 10, 'XC' => 90, 'L' => 50, 'XL' => 40, 'X' => 10,
'IX' => 9, 'V' => 5, 'IV' => 4, 'I' => 1 'IX' => 9, 'V' => 5, 'IV' => 4, 'I' => 1,
]; ];
/** /**

View File

@ -168,7 +168,7 @@ class Repository
*/ */
private function run(string $cmd) : array private function run(string $cmd) : array
{ {
if (\strtolower((string) \substr(PHP_OS, 0, 3)) == 'win') { if (\strtolower((string) \substr(\PHP_OS, 0, 3)) == 'win') {
$cmd = 'cd ' . \escapeshellarg(\dirname(Git::getBin())) $cmd = 'cd ' . \escapeshellarg(\dirname(Git::getBin()))
. ' && ' . \basename(Git::getBin()) . ' && ' . \basename(Git::getBin())
. ' -C ' . \escapeshellarg($this->path) . ' ' . ' -C ' . \escapeshellarg($this->path) . ' '
@ -672,7 +672,7 @@ class Repository
while (!\feof($fh)) { while (!\feof($fh)) {
\fgets($fh); \fgets($fh);
$loc++; ++$loc;
} }
\fclose($fh); \fclose($fh);

View File

@ -56,7 +56,7 @@ class CsvSettings
if (\count($fields) > 1) { if (\count($fields) > 1) {
if (!empty($results[$delimiter])) { if (!empty($results[$delimiter])) {
$results[$delimiter]++; ++$results[$delimiter];
} else { } else {
$results[$delimiter] = 1; $results[$delimiter] = 1;
} }

View File

@ -183,7 +183,7 @@ class Markdown
* @since 1.0.0 * @since 1.0.0
*/ */
private static $continuable = [ private static $continuable = [
'Code', 'FencedCode', 'List', 'Quote', 'Table' 'Code', 'FencedCode', 'List', 'Quote', 'Table',
]; ];
/** /**
@ -193,7 +193,7 @@ class Markdown
* @since 1.0.0 * @since 1.0.0
*/ */
private static $completable = [ private static $completable = [
'Code', 'FencedCode' 'Code', 'FencedCode',
]; ];
/** /**
@ -253,7 +253,7 @@ class Markdown
$currentBlock = null; $currentBlock = null;
foreach ($lines as $line) { foreach ($lines as $line) {
if (\chop($line) === '') { if (\rtrim($line) === '') {
if (isset($currentBlock)) { if (isset($currentBlock)) {
$currentBlock['interrupted'] = true; $currentBlock['interrupted'] = true;
} }
@ -277,7 +277,7 @@ class Markdown
$indent = 0; $indent = 0;
while (isset($line[$indent]) && $line[$indent] === ' ') { while (isset($line[$indent]) && $line[$indent] === ' ') {
$indent ++; ++$indent;
} }
$text = $indent > 0 ? \substr($line, $indent) : $line; $text = $indent > 0 ? \substr($line, $indent) : $line;
@ -463,7 +463,7 @@ class Markdown
'name' => 'pre', 'name' => 'pre',
'handler' => 'element', 'handler' => 'element',
'text' => $elementArray, 'text' => $elementArray,
] ],
]; ];
} }
@ -532,7 +532,7 @@ class Markdown
$level = 1; $level = 1;
while (isset($lineArray['text'][$level]) && $lineArray['text'][$level] === '#') { while (isset($lineArray['text'][$level]) && $lineArray['text'][$level] === '#') {
$level ++; ++$level;
} }
if ($level > 6) { if ($level > 6) {
@ -725,7 +725,7 @@ class Markdown
return [ return [
'element' => [ 'element' => [
'name' => 'hr' 'name' => 'hr',
], ],
]; ];
} }
@ -746,7 +746,7 @@ class Markdown
return null; return null;
} }
if (\chop($lineArray['text'], $lineArray['text'][0]) !== '') { if (\rtrim($lineArray['text'], $lineArray['text'][0]) !== '') {
return null; return null;
} }
@ -796,7 +796,7 @@ class Markdown
return null; return null;
} }
if (\strpos($block['element']['text'], '|') !== false && \chop($lineArray['text'], ' -:|') === '') { if (\strpos($block['element']['text'], '|') !== false && \rtrim($lineArray['text'], ' -:|') === '') {
$alignments = []; $alignments = [];
$divider = $lineArray['text']; $divider = $lineArray['text'];
$divider = \trim($divider); $divider = \trim($divider);
@ -1293,7 +1293,7 @@ class Markdown
return null; return null;
} }
if (!\preg_match('/\bhttps?:[\/]{2}[^\s<]+\b\/*/ui', $excerpt['context'], $matches, PREG_OFFSET_CAPTURE)) { if (!\preg_match('/\bhttps?:[\/]{2}[^\s<]+\b\/*/ui', $excerpt['context'], $matches, \PREG_OFFSET_CAPTURE)) {
return null; return null;
} }
@ -1503,7 +1503,7 @@ class Markdown
*/ */
protected static function escape(string $text, bool $allowQuotes = false) : string protected static function escape(string $text, bool $allowQuotes = false) : string
{ {
return \htmlspecialchars($text, $allowQuotes ? ENT_NOQUOTES : ENT_QUOTES, 'UTF-8'); return \htmlspecialchars($text, $allowQuotes ? \ENT_NOQUOTES : \ENT_QUOTES, 'UTF-8');
} }
/** /**

View File

@ -60,8 +60,8 @@ class File
$source = self::$extensions; $source = self::$extensions;
} }
$key = \rand(0, \count($source) - 1); $key = \mt_rand(0, \count($source) - 1);
return $source[$key][\rand(0, \count($source[$key]) - 1)]; return $source[$key][\mt_rand(0, \count($source[$key]) - 1)];
} }
} }

View File

@ -478,7 +478,7 @@ class Name
'Yıldırım', 'Öztürk', 'Aydın', 'Özdemir', 'Arslan', 'Doğan', 'Kılıç', 'Aslan', 'Çetin', 'Kara', 'Yıldırım', 'Öztürk', 'Aydın', 'Özdemir', 'Arslan', 'Doğan', 'Kılıç', 'Aslan', 'Çetin', 'Kara',
'Koç', 'Kurt', 'Özkan', 'Şimşek', 'Koç', 'Kurt', 'Özkan', 'Şimşek',
], ],
] ],
]; ];
/** /**

View File

@ -53,7 +53,7 @@ class Phone
$numberString = \str_replace( $numberString = \str_replace(
'$1', '$1',
$countries[\array_keys($countries)[\rand(0, \count($countries) - 1)]], $countries[\array_keys($countries)[\mt_rand(0, \count($countries) - 1)]],
$numberString $numberString
); );
} }

View File

@ -91,7 +91,7 @@ class Text
/** /**
* Set if the text should have formatting. * Set if the text should have formatting.
* *
* @param bool $hasFormatting Text has formatting. * @param bool $hasFormatting text has formatting
* *
* @return void * @return void
* *
@ -187,11 +187,11 @@ class Text
if ($newSentence) { if ($newSentence) {
$word = \ucfirst($word); $word = \ucfirst($word);
$sentenceCount++; ++$sentenceCount;
/** @noinspection PhpUndefinedVariableInspection */ /** @noinspection PhpUndefinedVariableInspection */
if ($this->hasParagraphs) { if ($this->hasParagraphs) {
$paid++; ++$paid;
$text .= '</p><p>'; $text .= '</p><p>';
} }
@ -206,7 +206,7 @@ class Text
if ($punctuation[$puid][0] === $i) { if ($punctuation[$puid][0] === $i) {
$text .= $punctuation[$puid][1]; $text .= $punctuation[$puid][1];
$puid++; ++$puid;
} }
} }

View File

@ -71,7 +71,7 @@ final class StringCompare
*/ */
public function matchDictionary(string $match) : string public function matchDictionary(string $match) : string
{ {
$bestScore = PHP_INT_MAX; $bestScore = \PHP_INT_MAX;
$bestMatch = ''; $bestMatch = '';
foreach ($this->dictionary as $word) { foreach ($this->dictionary as $word) {
@ -103,7 +103,7 @@ final class StringCompare
$total = 0; $total = 0;
if ($words1 === false || $words2 === false) { if ($words1 === false || $words2 === false) {
return PHP_INT_MAX; return \PHP_INT_MAX;
} }
foreach ($words1 as $word1) { foreach ($words1 as $word1) {

View File

@ -53,7 +53,7 @@ final class StringUtils
* *
* @example StringUtils::contains('This string', ['This', 'test']); // true * @example StringUtils::contains('This string', ['This', 'test']); // true
* *
* @return bool The function returns true if any of the needles is part of the haystack, false otherwise. * @return bool the function returns true if any of the needles is part of the haystack, false otherwise
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -78,7 +78,7 @@ final class StringUtils
* *
* @example StringUtils::mb_contains('This string', ['This', 'test']); // true * @example StringUtils::mb_contains('This string', ['This', 'test']); // true
* *
* @return bool The function returns true if any of the needles is part of the haystack, false otherwise. * @return bool the function returns true if any of the needles is part of the haystack, false otherwise
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -100,11 +100,11 @@ final class StringUtils
* In case of an array the function will test if any of the needles is at the end of the haystack string. * In case of an array the function will test if any of the needles is at the end of the haystack string.
* *
* @param string $haystack Haystack * @param string $haystack Haystack
* @param array|string $needles Needles to check if they are at the end of the haystack. * @param array|string $needles needles to check if they are at the end of the haystack
* *
* @example StringUtils::endsWith('Test string', ['test1', 'string']); // true * @example StringUtils::endsWith('Test string', ['test1', 'string']); // true
* *
* @return bool The function returns true if any of the needles is at the end of the haystack, false otherwise. * @return bool the function returns true if any of the needles is at the end of the haystack, false otherwise
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -130,13 +130,13 @@ final class StringUtils
* In case of an array the function will test if any of the needles is at the beginning of the haystack string. * In case of an array the function will test if any of the needles is at the beginning of the haystack string.
* *
* @param string $haystack Haystack * @param string $haystack Haystack
* @param array|string $needles Needles to check if they are at the beginning of the haystack. * @param array|string $needles needles to check if they are at the beginning of the haystack
* *
* @example StringUtils::startsWith('Test string', ['Test', 'something']); // true * @example StringUtils::startsWith('Test string', ['Test', 'something']); // true
* @example StringUtils::startsWith('Test string', 'string'); // false * @example StringUtils::startsWith('Test string', 'string'); // false
* @example StringUtils::startsWith('Test string', 'Test'); // true * @example StringUtils::startsWith('Test string', 'Test'); // true
* *
* @return bool The function returns true if any of the needles is at the beginning of the haystack, false otherwise. * @return bool the function returns true if any of the needles is at the beginning of the haystack, false otherwise
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -162,9 +162,9 @@ final class StringUtils
* In case of an array the function will test if any of the needles is at the beginning of the haystack string. * In case of an array the function will test if any of the needles is at the beginning of the haystack string.
* *
* @param string $haystack Haystack * @param string $haystack Haystack
* @param array|string $needles Needles to check if they are at the beginning of the haystack. * @param array|string $needles needles to check if they are at the beginning of the haystack
* *
* @return bool The function returns true if any of the needles is at the beginning of the haystack, false otherwise. * @return bool the function returns true if any of the needles is at the beginning of the haystack, false otherwise
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -190,13 +190,13 @@ final class StringUtils
* In case of an array the function will test if any of the needles is at the end of the haystack string. * In case of an array the function will test if any of the needles is at the end of the haystack string.
* *
* @param string $haystack Haystack * @param string $haystack Haystack
* @param array|string $needles Needles to check if they are at the end of the haystack. * @param array|string $needles needles to check if they are at the end of the haystack
* *
* @example StringUtils::endsWith('Test string', ['test1', 'string']); // true * @example StringUtils::endsWith('Test string', ['test1', 'string']); // true
* @example StringUtils::endsWith('Test string', 'string'); // true * @example StringUtils::endsWith('Test string', 'string'); // true
* @example StringUtils::endsWith('Test string', String); // false * @example StringUtils::endsWith('Test string', String); // false
* *
* @return bool The function returns true if any of the needles is at the end of the haystack, false otherwise. * @return bool the function returns true if any of the needles is at the end of the haystack, false otherwise
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -218,9 +218,9 @@ final class StringUtils
/** /**
* Makes first letter of a multi byte string upper case. * Makes first letter of a multi byte string upper case.
* *
* @param string $string String to upper case first letter. * @param string $string string to upper case first letter
* *
* @return string Multi byte string with first character as upper case. * @return string multi byte string with first character as upper case
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -236,9 +236,9 @@ final class StringUtils
/** /**
* Makes first letter of a multi byte string lower case. * Makes first letter of a multi byte string lower case.
* *
* @param string $string String to lower case first letter. * @param string $string string to lower case first letter
* *
* @return string Multi byte string with first character as lower case. * @return string multi byte string with first character as lower case
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -254,10 +254,10 @@ final class StringUtils
/** /**
* Trim multi byte characters from a multi byte string. * Trim multi byte characters from a multi byte string.
* *
* @param string $string Multi byte string to trim multi byte characters from. * @param string $string multi byte string to trim multi byte characters from
* @param string $charlist Multi byte character list used for trimming * @param string $charlist Multi byte character list used for trimming
* *
* @return string Trimmed multi byte string. * @return string trimmed multi byte string
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -275,10 +275,10 @@ final class StringUtils
/** /**
* Trim multi byte characters from the right of a multi byte string. * Trim multi byte characters from the right of a multi byte string.
* *
* @param string $string Multi byte string to trim multi byte characters from. * @param string $string multi byte string to trim multi byte characters from
* @param string $charlist Multi byte character list used for trimming * @param string $charlist Multi byte character list used for trimming
* *
* @return string Trimmed multi byte string. * @return string trimmed multi byte string
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -296,10 +296,10 @@ final class StringUtils
/** /**
* Trim multi byte characters from the left of a multi byte string. * Trim multi byte characters from the left of a multi byte string.
* *
* @param string $string Multi byte string to trim multi byte characters from. * @param string $string multi byte string to trim multi byte characters from
* @param string $charlist Multi byte character list used for trimming * @param string $charlist Multi byte character list used for trimming
* *
* @return string Trimmed multi byte string. * @return string trimmed multi byte string
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -317,13 +317,13 @@ final class StringUtils
/** /**
* Count occurences of character at the beginning of a string. * Count occurences of character at the beginning of a string.
* *
* @param string $string String to analyze. * @param string $string string to analyze
* @param string $character Character to count at the beginning of the string. * @param string $character character to count at the beginning of the string
* *
* @example StringUtils::countCharacterFromStart(' Test string', ' '); // 4 * @example StringUtils::countCharacterFromStart(' Test string', ' '); // 4
* @example StringUtils::countCharacterFromStart(' Test string', 's'); // 0 * @example StringUtils::countCharacterFromStart(' Test string', 's'); // 0
* *
* @return int The amount of repeating occurences at the beginning of the string. * @return int the amount of repeating occurences at the beginning of the string
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -346,7 +346,7 @@ final class StringUtils
/** /**
* Calculate string entropy * Calculate string entropy
* *
* @param string $value String to analyze. * @param string $value string to analyze
* *
* @return float * @return float
* *
@ -369,7 +369,7 @@ final class StringUtils
/** /**
* Count chars of utf-8 string. * Count chars of utf-8 string.
* *
* @param string $input String to count chars. * @param string $input string to count chars
* *
* @return array<string, int> * @return array<string, int>
* *
@ -387,7 +387,7 @@ final class StringUtils
$unique[$char] = 0; $unique[$char] = 0;
} }
$unique[$char]++; ++$unique[$char];
} }
return $unique; return $unique;
@ -396,7 +396,7 @@ final class StringUtils
/** /**
* Turn value into string * Turn value into string
* *
* @param mixed $element Value to stringify. * @param mixed $element value to stringify
* @param mixed $option Stringify option * @param mixed $option Stringify option
* *
* @return null|string * @return null|string

View File

@ -31,7 +31,7 @@ class Cron extends SchedulerAbstract
public function create(TaskAbstract $task) : void public function create(TaskAbstract $task) : void
{ {
$this->run('-l > ' . __DIR__ . '/tmpcron.tmp'); $this->run('-l > ' . __DIR__ . '/tmpcron.tmp');
\file_put_contents(__DIR__ . '/tmpcron.tmp', $task->__toString() . "\n", FILE_APPEND); \file_put_contents(__DIR__ . '/tmpcron.tmp', $task->__toString() . "\n", \FILE_APPEND);
$this->run(__DIR__ . '/tmpcron.tmp'); $this->run(__DIR__ . '/tmpcron.tmp');
\unlink(__DIR__ . '/tmpcron.tmp'); \unlink(__DIR__ . '/tmpcron.tmp');
} }

View File

@ -65,9 +65,9 @@ final class CreditCard extends ValidatorAbstract
/** /**
* Luhn algorithm or mod 10 algorithm is used to verify credit cards. * Luhn algorithm or mod 10 algorithm is used to verify credit cards.
* *
* @param string $num Credit card number. * @param string $num credit card number
* *
* @return bool Returns true if the number is a valid credit card and false if it isn't. * @return bool returns true if the number is a valid credit card and false if it isn't
* *
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -97,7 +97,7 @@ final class Iban extends ValidatorAbstract
return false; return false;
} }
$lastPos += 1; ++$lastPos;
} }
return true; return true;
@ -125,7 +125,7 @@ final class Iban extends ValidatorAbstract
return false; return false;
} }
$lastPos += 1; ++$lastPos;
} }
return true; return true;

View File

@ -42,7 +42,7 @@ abstract class Email extends ValidatorAbstract
*/ */
public static function isValid($value, array $constraints = null) : bool public static function isValid($value, array $constraints = null) : bool
{ {
if (\filter_var($value, FILTER_VALIDATE_EMAIL) === false) { if (\filter_var($value, \FILTER_VALIDATE_EMAIL) === false) {
self::$msg = 'Invalid Email by filter_var standards'; self::$msg = 'Invalid Email by filter_var standards';
self::$error = 1; self::$error = 1;

View File

@ -42,6 +42,6 @@ abstract class Hostname extends ValidatorAbstract
*/ */
public static function isValid($value, array $constraints = null) : bool public static function isValid($value, array $constraints = null) : bool
{ {
return \filter_var(\gethostbyname($value), FILTER_VALIDATE_IP) !== false; return \filter_var(\gethostbyname($value), \FILTER_VALIDATE_IP) !== false;
} }
} }

View File

@ -42,7 +42,7 @@ abstract class Ip extends ValidatorAbstract
*/ */
public static function isValid($value, array $constraints = null) : bool public static function isValid($value, array $constraints = null) : bool
{ {
return \filter_var($value, FILTER_VALIDATE_IP) !== false; return \filter_var($value, \FILTER_VALIDATE_IP) !== false;
} }
/** /**
@ -56,7 +56,7 @@ abstract class Ip extends ValidatorAbstract
*/ */
public static function isValidIpv6($value) : bool public static function isValidIpv6($value) : bool
{ {
return \filter_var($value, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) !== false; return \filter_var($value, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV6) !== false;
} }
/** /**
@ -70,6 +70,6 @@ abstract class Ip extends ValidatorAbstract
*/ */
public static function isValidIpv4($value) : bool public static function isValidIpv4($value) : bool
{ {
return \filter_var($value, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) !== false; return \filter_var($value, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV4) !== false;
} }
} }

View File

@ -35,7 +35,7 @@ final class Validator extends ValidatorAbstract
* *
* @return bool * @return bool
* *
* @throws \BadFunctionCallException This exception is thrown if the callback is not callable. * @throws \BadFunctionCallException this exception is thrown if the callback is not callable
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -99,7 +99,7 @@ final class Validator extends ValidatorAbstract
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public static function hasLength(string $var, int $min = 0, int $max = PHP_INT_MAX) : bool public static function hasLength(string $var, int $min = 0, int $max = \PHP_INT_MAX) : bool
{ {
$length = \strlen($var); $length = \strlen($var);
@ -151,7 +151,7 @@ final class Validator extends ValidatorAbstract
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public static function hasLimit($var, $min = 0, $max = PHP_INT_MAX) : bool public static function hasLimit($var, $min = 0, $max = \PHP_INT_MAX) : bool
{ {
if ($var <= $max && $var >= $min) { if ($var <= $max && $var >= $min) {
return true; return true;

View File

@ -1,4 +1,4 @@
<?php <?php declare(strict_types=1);
/** /**
* Orange Management * Orange Management
* *

View File

@ -24,7 +24,7 @@ namespace phpOMS\Views;
*/ */
class TableView extends View class TableView extends View
{ {
public function renderHeaderColumn(string $inner, bool $sortable = true, bool $filterable = true) public function renderHeaderColumn(string $inner, bool $sortable = true, bool $filterable = true): void
{ {
} }

View File

@ -210,7 +210,7 @@ class View extends ViewAbstract
* *
* @return void * @return void
* *
* @throws InvalidModuleException Throws this exception if no data for the defined module could be found. * @throws InvalidModuleException throws this exception if no data for the defined module could be found
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -238,7 +238,7 @@ class View extends ViewAbstract
* *
* @return void * @return void
* *
* @throws InvalidThemeException Throws this exception if no data for the defined theme could be found. * @throws InvalidThemeException throws this exception if no data for the defined theme could be found
* *
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -138,7 +138,7 @@ abstract class ViewAbstract implements RenderableInterface
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public function getView($id) public function getView(string $id)
{ {
if (!isset($this->views[$id])) { if (!isset($this->views[$id])) {
return false; return false;

View File

@ -10,6 +10,7 @@
* @version 1.0.0 * @version 1.0.0
* @link http://website.orange-management.de * @link http://website.orange-management.de
*/ */
declare(strict_types=1);
namespace phpOMS\tests\Account; namespace phpOMS\tests\Account;
@ -20,6 +21,8 @@ require_once __DIR__ . '/../Autoloader.php';
/** /**
* @testdox phpOMS\tests\Account\AccountManager: Account/user manager to handle/access loaded accounts * @testdox phpOMS\tests\Account\AccountManager: Account/user manager to handle/access loaded accounts
*
* @internal
*/ */
class AccountManagerTest extends \PHPUnit\Framework\TestCase class AccountManagerTest extends \PHPUnit\Framework\TestCase
{ {

View File

@ -10,6 +10,7 @@
* @version 1.0.0 * @version 1.0.0
* @link http://website.orange-management.de * @link http://website.orange-management.de
*/ */
declare(strict_types=1);
namespace phpOMS\tests\Account; namespace phpOMS\tests\Account;
@ -17,11 +18,14 @@ require_once __DIR__ . '/../Autoloader.php';
use phpOMS\Account\AccountStatus; use phpOMS\Account\AccountStatus;
/**
* @internal
*/
class AccountStatusTest extends \PHPUnit\Framework\TestCase class AccountStatusTest extends \PHPUnit\Framework\TestCase
{ {
public function testEnums() : void public function testEnums() : void
{ {
self::assertEquals(4, \count(AccountStatus::getConstants())); self::assertCount(4, AccountStatus::getConstants());
self::assertEquals(1, AccountStatus::ACTIVE); self::assertEquals(1, AccountStatus::ACTIVE);
self::assertEquals(2, AccountStatus::INACTIVE); self::assertEquals(2, AccountStatus::INACTIVE);
self::assertEquals(3, AccountStatus::TIMEOUT); self::assertEquals(3, AccountStatus::TIMEOUT);

View File

@ -10,6 +10,7 @@
* @version 1.0.0 * @version 1.0.0
* @link http://website.orange-management.de * @link http://website.orange-management.de
*/ */
declare(strict_types=1);
namespace phpOMS\tests\Account; namespace phpOMS\tests\Account;
@ -26,6 +27,8 @@ require_once __DIR__ . '/../Autoloader.php';
/** /**
* @testdox phpOMS\tests\Account\Account: Base account/user representation * @testdox phpOMS\tests\Account\Account: Base account/user representation
*
* @internal
*/ */
class AccountTest extends \PHPUnit\Framework\TestCase class AccountTest extends \PHPUnit\Framework\TestCase
{ {
@ -69,31 +72,31 @@ class AccountTest extends \PHPUnit\Framework\TestCase
$account = new Account(); $account = new Account();
/* Testing default values */ /* Testing default values */
self::assertTrue(\is_int($account->getId())); self::assertIsInt($account->getId());
self::assertEquals(0, $account->getId()); self::assertEquals(0, $account->getId());
self::assertInstanceOf('\phpOMS\Localization\Localization', $account->getL11n()); self::assertInstanceOf('\phpOMS\Localization\Localization', $account->getL11n());
self::assertEquals([], $account->getGroups()); self::assertEquals([], $account->getGroups());
self::assertEquals(null, $account->getName()); self::assertNull($account->getName());
self::assertTrue(\is_string($account->getName1())); self::assertIsString($account->getName1());
self::assertEquals('', $account->getName1()); self::assertEquals('', $account->getName1());
self::assertTrue(\is_string($account->getName2())); self::assertIsString($account->getName2());
self::assertEquals('', $account->getName2()); self::assertEquals('', $account->getName2());
self::assertTrue(\is_string($account->getName3())); self::assertIsString($account->getName3());
self::assertEquals('', $account->getName3()); self::assertEquals('', $account->getName3());
self::assertTrue(\is_string($account->getEmail())); self::assertIsString($account->getEmail());
self::assertEquals('', $account->getEmail()); self::assertEquals('', $account->getEmail());
self::assertTrue(\is_int($account->getStatus())); self::assertIsInt($account->getStatus());
self::assertEquals(AccountStatus::INACTIVE, $account->getStatus()); self::assertEquals(AccountStatus::INACTIVE, $account->getStatus());
self::assertTrue(\is_int($account->getType())); self::assertIsInt($account->getType());
self::assertEquals(AccountType::USER, $account->getType()); self::assertEquals(AccountType::USER, $account->getType());
self::assertEquals([], $account->getPermissions()); self::assertEquals([], $account->getPermissions());
@ -102,7 +105,7 @@ class AccountTest extends \PHPUnit\Framework\TestCase
self::assertInstanceOf('\DateTime', $account->getCreatedAt()); self::assertInstanceOf('\DateTime', $account->getCreatedAt());
$array = $account->toArray(); $array = $account->toArray();
self::assertTrue(\is_array($array)); self::assertIsArray($array);
self::assertGreaterThan(0, \count($array)); self::assertGreaterThan(0, \count($array));
self::assertEquals(\json_encode($array), $account->__toString()); self::assertEquals(\json_encode($array), $account->__toString());
self::assertEquals($array, $account->jsonSerialize()); self::assertEquals($array, $account->jsonSerialize());
@ -141,7 +144,7 @@ class AccountTest extends \PHPUnit\Framework\TestCase
$account->generatePassword('abcd'); $account->generatePassword('abcd');
$account->addGroup(new Group()); $account->addGroup(new Group());
self::assertEquals(1, \count($account->getGroups())); self::assertCount(1, $account->getGroups());
} }
/** /**
@ -188,26 +191,26 @@ class AccountTest extends \PHPUnit\Framework\TestCase
$account = new Account(); $account = new Account();
$account->generatePassword('abcd'); $account->generatePassword('abcd');
$account->addPermission(new class extends PermissionAbstract {}); $account->addPermission(new class() extends PermissionAbstract {});
self::assertEquals(1, \count($account->getPermissions())); self::assertCount(1, $account->getPermissions());
$account->setPermissions([ $account->setPermissions([
new class extends PermissionAbstract {}, new class() extends PermissionAbstract {},
new class extends PermissionAbstract {}, new class() extends PermissionAbstract {},
]); ]);
self::assertEquals(2, \count($account->getPermissions())); self::assertCount(2, $account->getPermissions());
$account->addPermissions([ $account->addPermissions([
new class extends PermissionAbstract {}, new class() extends PermissionAbstract {},
new class extends PermissionAbstract {}, new class() extends PermissionAbstract {},
]); ]);
self::assertEquals(4, \count($account->getPermissions())); self::assertCount(4, $account->getPermissions());
$account->addPermissions([[ $account->addPermissions([[
new class extends PermissionAbstract {}, new class() extends PermissionAbstract {},
new class extends PermissionAbstract {}, new class() extends PermissionAbstract {},
]]); ]]);
self::assertEquals(6, \count($account->getPermissions())); self::assertCount(6, $account->getPermissions());
self::assertFalse($account->hasPermission(PermissionType::READ, 1, 'a', 'a', 1, 1, 1)); self::assertFalse($account->hasPermission(PermissionType::READ, 1, 'a', 'a', 1, 1, 1));
self::assertTrue($account->hasPermission(PermissionType::NONE)); self::assertTrue($account->hasPermission(PermissionType::NONE));
@ -260,7 +263,7 @@ class AccountTest extends \PHPUnit\Framework\TestCase
$rand = 0; $rand = 0;
do { do {
$rand = \mt_rand(PHP_INT_MIN, PHP_INT_MAX); $rand = \mt_rand(\PHP_INT_MIN, \PHP_INT_MAX);
} while (AccountStatus::isValidValue($rand)); } while (AccountStatus::isValidValue($rand));
$account->setStatus($rand); $account->setStatus($rand);
@ -277,7 +280,7 @@ class AccountTest extends \PHPUnit\Framework\TestCase
$rand = 0; $rand = 0;
do { do {
$rand = \mt_rand(PHP_INT_MIN, PHP_INT_MAX); $rand = \mt_rand(\PHP_INT_MIN, \PHP_INT_MAX);
} while (AccountType::isValidValue($rand)); } while (AccountType::isValidValue($rand));
$account->setType($rand); $account->setType($rand);

View File

@ -10,6 +10,7 @@
* @version 1.0.0 * @version 1.0.0
* @link http://website.orange-management.de * @link http://website.orange-management.de
*/ */
declare(strict_types=1);
namespace phpOMS\tests\Account; namespace phpOMS\tests\Account;
@ -17,11 +18,14 @@ require_once __DIR__ . '/../Autoloader.php';
use phpOMS\Account\AccountType; use phpOMS\Account\AccountType;
/**
* @internal
*/
class AccountTypeTest extends \PHPUnit\Framework\TestCase class AccountTypeTest extends \PHPUnit\Framework\TestCase
{ {
public function testEnums() : void public function testEnums() : void
{ {
self::assertEquals(2, \count(AccountType::getConstants())); self::assertCount(2, AccountType::getConstants());
self::assertEquals(0, AccountType::USER); self::assertEquals(0, AccountType::USER);
self::assertEquals(1, AccountType::GROUP); self::assertEquals(1, AccountType::GROUP);
} }

View File

@ -10,6 +10,7 @@
* @version 1.0.0 * @version 1.0.0
* @link http://website.orange-management.de * @link http://website.orange-management.de
*/ */
declare(strict_types=1);
namespace phpOMS\tests\Account; namespace phpOMS\tests\Account;
@ -17,11 +18,14 @@ require_once __DIR__ . '/../Autoloader.php';
use phpOMS\Account\GroupStatus; use phpOMS\Account\GroupStatus;
/**
* @internal
*/
class GroupStatusTest extends \PHPUnit\Framework\TestCase class GroupStatusTest extends \PHPUnit\Framework\TestCase
{ {
public function testEnums() : void public function testEnums() : void
{ {
self::assertEquals(3, \count(GroupStatus::getConstants())); self::assertCount(3, GroupStatus::getConstants());
self::assertEquals(1, GroupStatus::ACTIVE); self::assertEquals(1, GroupStatus::ACTIVE);
self::assertEquals(2, GroupStatus::INACTIVE); self::assertEquals(2, GroupStatus::INACTIVE);
self::assertEquals(4, GroupStatus::HIDDEN); self::assertEquals(4, GroupStatus::HIDDEN);

View File

@ -10,6 +10,7 @@
* @version 1.0.0 * @version 1.0.0
* @link http://website.orange-management.de * @link http://website.orange-management.de
*/ */
declare(strict_types=1);
namespace phpOMS\tests\Account; namespace phpOMS\tests\Account;
@ -22,6 +23,8 @@ require_once __DIR__ . '/../Autoloader.php';
/** /**
* @testdox phpOMS\tests\Account\Group: Base group representation * @testdox phpOMS\tests\Account\Group: Base group representation
*
* @internal
*/ */
class GroupTest extends \PHPUnit\Framework\TestCase class GroupTest extends \PHPUnit\Framework\TestCase
{ {
@ -51,20 +54,20 @@ class GroupTest extends \PHPUnit\Framework\TestCase
$group = new Group(); $group = new Group();
/* Testing default values */ /* Testing default values */
self::assertTrue(\is_int($group->getId())); self::assertIsInt($group->getId());
self::assertEquals(0, $group->getId()); self::assertEquals(0, $group->getId());
self::assertTrue(\is_string($group->getName())); self::assertIsString($group->getName());
self::assertEquals('', $group->getName()); self::assertEquals('', $group->getName());
self::assertTrue(\is_int($group->getStatus())); self::assertIsInt($group->getStatus());
self::assertEquals(GroupStatus::INACTIVE, $group->getStatus()); self::assertEquals(GroupStatus::INACTIVE, $group->getStatus());
self::assertTrue(\is_string($group->getDescription())); self::assertIsString($group->getDescription());
self::assertEquals('', $group->getDescription()); self::assertEquals('', $group->getDescription());
$array = $group->toArray(); $array = $group->toArray();
self::assertTrue(\is_array($array)); self::assertIsArray($array);
self::assertGreaterThan(0, \count($array)); self::assertGreaterThan(0, \count($array));
self::assertEquals(\json_encode($array), $group->__toString()); self::assertEquals(\json_encode($array), $group->__toString());
self::assertEquals($array, $group->jsonSerialize()); self::assertEquals($array, $group->jsonSerialize());
@ -90,26 +93,26 @@ class GroupTest extends \PHPUnit\Framework\TestCase
public function testPermissionHandling() : void public function testPermissionHandling() : void
{ {
$group = new Group(); $group = new Group();
$group->addPermission(new class extends PermissionAbstract {}); $group->addPermission(new class() extends PermissionAbstract {});
self::assertEquals(1, \count($group->getPermissions())); self::assertCount(1, $group->getPermissions());
$group->setPermissions([ $group->setPermissions([
new class extends PermissionAbstract {}, new class() extends PermissionAbstract {},
new class extends PermissionAbstract {}, new class() extends PermissionAbstract {},
]); ]);
self::assertEquals(2, \count($group->getPermissions())); self::assertCount(2, $group->getPermissions());
$group->addPermissions([ $group->addPermissions([
new class extends PermissionAbstract {}, new class() extends PermissionAbstract {},
new class extends PermissionAbstract {}, new class() extends PermissionAbstract {},
]); ]);
self::assertEquals(4, \count($group->getPermissions())); self::assertCount(4, $group->getPermissions());
$group->addPermissions([[ $group->addPermissions([[
new class extends PermissionAbstract {}, new class() extends PermissionAbstract {},
new class extends PermissionAbstract {}, new class() extends PermissionAbstract {},
]]); ]]);
self::assertEquals(6, \count($group->getPermissions())); self::assertCount(6, $group->getPermissions());
self::assertFalse($group->hasPermission(PermissionType::READ, 1, 'a', 'a', 1, 1, 1)); self::assertFalse($group->hasPermission(PermissionType::READ, 1, 'a', 'a', 1, 1, 1));
self::assertTrue($group->hasPermission(PermissionType::NONE)); self::assertTrue($group->hasPermission(PermissionType::NONE));
@ -137,7 +140,7 @@ class GroupTest extends \PHPUnit\Framework\TestCase
$rand = 0; $rand = 0;
do { do {
$rand = \mt_rand(PHP_INT_MIN, PHP_INT_MAX); $rand = \mt_rand(\PHP_INT_MIN, \PHP_INT_MAX);
} while (GroupStatus::isValidValue($rand)); } while (GroupStatus::isValidValue($rand));
$group->setStatus($rand); $group->setStatus($rand);

View File

@ -10,6 +10,7 @@
* @version 1.0.0 * @version 1.0.0
* @link http://website.orange-management.de * @link http://website.orange-management.de
*/ */
declare(strict_types=1);
namespace phpOMS\tests\Account; namespace phpOMS\tests\Account;
@ -17,6 +18,9 @@ require_once __DIR__ . '/../Autoloader.php';
use phpOMS\Account\NullAccount; use phpOMS\Account\NullAccount;
/**
* @internal
*/
class NullAccountTest extends \PHPUnit\Framework\TestCase class NullAccountTest extends \PHPUnit\Framework\TestCase
{ {
public function testNull() : void public function testNull() : void

View File

@ -10,6 +10,7 @@
* @version 1.0.0 * @version 1.0.0
* @link http://website.orange-management.de * @link http://website.orange-management.de
*/ */
declare(strict_types=1);
namespace phpOMS\tests\Account; namespace phpOMS\tests\Account;
@ -18,20 +19,23 @@ require_once __DIR__ . '/../Autoloader.php';
use phpOMS\Account\PermissionAbstract; use phpOMS\Account\PermissionAbstract;
use phpOMS\Account\PermissionType; use phpOMS\Account\PermissionType;
/**
* @internal
*/
class PermissionAbstractTest extends \PHPUnit\Framework\TestCase class PermissionAbstractTest extends \PHPUnit\Framework\TestCase
{ {
public function testAbstractDefault() : void public function testAbstractDefault() : void
{ {
$perm = new class extends PermissionAbstract {}; $perm = new class() extends PermissionAbstract {};
self::assertEquals(0, $perm->getId()); self::assertEquals(0, $perm->getId());
self::assertEquals(null, $perm->getUnit()); self::assertNull($perm->getUnit());
self::assertEquals(null, $perm->getApp()); self::assertNull($perm->getApp());
self::assertEquals(null, $perm->getModule()); self::assertNull($perm->getModule());
self::assertEquals(0, $perm->getFrom()); self::assertEquals(0, $perm->getFrom());
self::assertEquals(null, $perm->getType()); self::assertNull($perm->getType());
self::assertEquals(null, $perm->getElement()); self::assertNull($perm->getElement());
self::assertEquals(null, $perm->getComponent()); self::assertNull($perm->getComponent());
self::assertEquals(PermissionType::NONE, $perm->getPermission()); self::assertEquals(PermissionType::NONE, $perm->getPermission());
self::assertEquals( self::assertEquals(
@ -52,7 +56,7 @@ class PermissionAbstractTest extends \PHPUnit\Framework\TestCase
public function testAbstractGetSet() : void public function testAbstractGetSet() : void
{ {
$perm = new class extends PermissionAbstract {}; $perm = new class() extends PermissionAbstract {};
$perm->setUnit(1); $perm->setUnit(1);
self::assertEquals(1, $perm->getUnit()); self::assertEquals(1, $perm->getUnit());
@ -60,8 +64,8 @@ class PermissionAbstractTest extends \PHPUnit\Framework\TestCase
$perm->setApp('Test'); $perm->setApp('Test');
self::assertEquals('Test', $perm->getApp()); self::assertEquals('Test', $perm->getApp());
$perm->setModule(2); $perm->setModule('2');
self::assertEquals(2, $perm->getModule()); self::assertEquals('2', $perm->getModule());
$perm->setFrom(3); $perm->setFrom(3);
self::assertEquals(3, $perm->getFrom()); self::assertEquals(3, $perm->getFrom());

View File

@ -10,6 +10,7 @@
* @version 1.0.0 * @version 1.0.0
* @link http://website.orange-management.de * @link http://website.orange-management.de
*/ */
declare(strict_types=1);
namespace phpOMS\tests\Account; namespace phpOMS\tests\Account;
@ -17,11 +18,14 @@ require_once __DIR__ . '/../Autoloader.php';
use phpOMS\Account\PermissionType; use phpOMS\Account\PermissionType;
/**
* @internal
*/
class PermissionTypeTest extends \PHPUnit\Framework\TestCase class PermissionTypeTest extends \PHPUnit\Framework\TestCase
{ {
public function testEnums() : void public function testEnums() : void
{ {
self::assertEquals(6, \count(PermissionType::getConstants())); self::assertCount(6, PermissionType::getConstants());
self::assertEquals(PermissionType::getConstants(), \array_unique(PermissionType::getConstants())); self::assertEquals(PermissionType::getConstants(), \array_unique(PermissionType::getConstants()));
self::assertEquals(1, PermissionType::NONE); self::assertEquals(1, PermissionType::NONE);

View File

@ -10,16 +10,20 @@
* @version 1.0.0 * @version 1.0.0
* @link http://website.orange-management.de * @link http://website.orange-management.de
*/ */
declare(strict_types=1);
namespace phpOMS\tests; namespace phpOMS\tests;
use phpOMS\ApplicationAbstract; use phpOMS\ApplicationAbstract;
/**
* @internal
*/
class ApplicationAbstractTest extends \PHPUnit\Framework\TestCase class ApplicationAbstractTest extends \PHPUnit\Framework\TestCase
{ {
public function testGetSet() : void public function testGetSet() : void
{ {
$obj = new class extends ApplicationAbstract {}; $obj = new class() extends ApplicationAbstract {};
$obj->appName = 'Test'; $obj->appName = 'Test';
self::assertEquals('Test', $obj->appName); self::assertEquals('Test', $obj->appName);

View File

@ -10,6 +10,7 @@
* @version 1.0.0 * @version 1.0.0
* @link http://website.orange-management.de * @link http://website.orange-management.de
*/ */
declare(strict_types=1);
namespace phpOMS\tests\Asset; namespace phpOMS\tests\Asset;
@ -19,6 +20,8 @@ require_once __DIR__ . '/../Autoloader.php';
/** /**
* @testdox phpOMS\tests\Asset\AssetManagerTest: Asset manager to handle/access assets * @testdox phpOMS\tests\Asset\AssetManagerTest: Asset manager to handle/access assets
*
* @internal
*/ */
class AssetManagerTest extends \PHPUnit\Framework\TestCase class AssetManagerTest extends \PHPUnit\Framework\TestCase
{ {

View File

@ -10,6 +10,7 @@
* @version 1.0.0 * @version 1.0.0
* @link http://website.orange-management.de * @link http://website.orange-management.de
*/ */
declare(strict_types=1);
namespace phpOMS\tests\Asset; namespace phpOMS\tests\Asset;
@ -17,11 +18,14 @@ require_once __DIR__ . '/../Autoloader.php';
use phpOMS\Asset\AssetType; use phpOMS\Asset\AssetType;
/**
* @internal
*/
class AssetTypeTest extends \PHPUnit\Framework\TestCase class AssetTypeTest extends \PHPUnit\Framework\TestCase
{ {
public function testEnums() : void public function testEnums() : void
{ {
self::assertEquals(3, \count(AssetType::getConstants())); self::assertCount(3, AssetType::getConstants());
self::assertEquals(0, AssetType::CSS); self::assertEquals(0, AssetType::CSS);
self::assertEquals(1, AssetType::JS); self::assertEquals(1, AssetType::JS);
self::assertEquals(2, AssetType::JSLATE); self::assertEquals(2, AssetType::JSLATE);

View File

@ -10,6 +10,7 @@
* @version 1.0.0 * @version 1.0.0
* @link http://website.orange-management.de * @link http://website.orange-management.de
*/ */
declare(strict_types=1);
namespace phpOMS\tests\Auth; namespace phpOMS\tests\Auth;
@ -19,6 +20,8 @@ require_once __DIR__ . '/../Autoloader.php';
/** /**
* @testdox phpOMS\tests\Auth\AuthTest: Account and session authentication * @testdox phpOMS\tests\Auth\AuthTest: Account and session authentication
*
* @internal
*/ */
class AuthTest extends \PHPUnit\Framework\TestCase class AuthTest extends \PHPUnit\Framework\TestCase
{ {

View File

@ -10,6 +10,7 @@
* @version 1.0.0 * @version 1.0.0
* @link http://website.orange-management.de * @link http://website.orange-management.de
*/ */
declare(strict_types=1);
namespace phpOMS\tests\Auth; namespace phpOMS\tests\Auth;
@ -17,11 +18,14 @@ require_once __DIR__ . '/../Autoloader.php';
use phpOMS\Auth\LoginReturnType; use phpOMS\Auth\LoginReturnType;
/**
* @internal
*/
class LoginReturnTypeTest extends \PHPUnit\Framework\TestCase class LoginReturnTypeTest extends \PHPUnit\Framework\TestCase
{ {
public function testEnums() : void public function testEnums() : void
{ {
self::assertEquals(11, \count(LoginReturnType::getConstants())); self::assertCount(11, LoginReturnType::getConstants());
self::assertEquals(0, LoginReturnType::OK); self::assertEquals(0, LoginReturnType::OK);
self::assertEquals(-1, LoginReturnType::FAILURE); self::assertEquals(-1, LoginReturnType::FAILURE);
self::assertEquals(-2, LoginReturnType::WRONG_PASSWORD); self::assertEquals(-2, LoginReturnType::WRONG_PASSWORD);

Some files were not shown because too many files have changed in this diff Show More