Improve codestyle

This commit is contained in:
Dennis Eichhorn 2018-02-03 10:30:13 +01:00
parent f1288ebc03
commit e4dadf447d
60 changed files with 274 additions and 309 deletions

View File

@ -112,7 +112,7 @@ abstract class SettingsAbstract implements OptionsInterface
return count($options) > 1 ? $options : reset($options); return count($options) > 1 ? $options : reset($options);
} catch (\PDOException $e) { } catch (\PDOException $e) {
$exception = DatabaseExceptionFactory::createException($e); $exception = DatabaseExceptionFactory::createException($e);
$message = DatabaseExceptionFactory::createExceptionMessage($e); $message = DatabaseExceptionFactory::createExceptionMessage($e);
throw new $exception($message); throw new $exception($message);
} }
@ -133,7 +133,7 @@ abstract class SettingsAbstract implements OptionsInterface
$this->setOptions($options); $this->setOptions($options);
if ($store) { if ($store) {
foreach($this->options as $key => $option) { foreach ($this->options as $key => $option) {
$query = new Builder($this->connection); $query = new Builder($this->connection);
$sql = $query->update($this->connection->prefix . static::$table) $sql = $query->update($this->connection->prefix . static::$table)
->set([static::$columns[1] => $option]) ->set([static::$columns[1] => $option])

View File

@ -85,5 +85,4 @@ interface ConnectionInterface
* @since 1.0.0 * @since 1.0.0
*/ */
public function getSchemaGrammar() : SchemaGrammar; public function getSchemaGrammar() : SchemaGrammar;
} }

View File

@ -72,4 +72,4 @@ class SqlServerConnection extends ConnectionAbstract
$this->dbdata['password'] = '****'; $this->dbdata['password'] = '****';
} }
} }
} }

View File

@ -648,8 +648,8 @@ class DataMapperAbstract implements DataMapperInterface
} }
/** @var string $mapper */ /** @var string $mapper */
$mapper = static::$hasMany[$propertyName]['mapper']; $mapper = static::$hasMany[$propertyName]['mapper'];
$objsIds = []; $objsIds = [];
foreach ($values as $key => &$value) { foreach ($values as $key => &$value) {
if (!is_object($value)) { if (!is_object($value)) {
@ -817,8 +817,7 @@ class DataMapperAbstract implements DataMapperInterface
private static function createRelationTable(string $propertyName, array $objsIds, $objId) private static function createRelationTable(string $propertyName, array $objsIds, $objId)
{ {
/** @var string $table */ /** @var string $table */
if ( if (!empty($objsIds)
!empty($objsIds)
&& static::$hasMany[$propertyName]['table'] !== static::$table && static::$hasMany[$propertyName]['table'] !== static::$table
&& static::$hasMany[$propertyName]['table'] !== static::$hasMany[$propertyName]['mapper']::$table && static::$hasMany[$propertyName]['table'] !== static::$hasMany[$propertyName]['mapper']::$table
) { ) {
@ -908,8 +907,8 @@ class DataMapperAbstract implements DataMapperInterface
} }
/** @var string $mapper */ /** @var string $mapper */
$mapper = static::$hasMany[$propertyName]['mapper']; $mapper = static::$hasMany[$propertyName]['mapper'];
$relReflectionClass = null; $relReflectionClass = null;
$objsIds[$propertyName] = []; $objsIds[$propertyName] = [];
foreach ($values as $key => &$value) { foreach ($values as $key => &$value) {
@ -1003,8 +1002,7 @@ class DataMapperAbstract implements DataMapperInterface
private static function deleteRelationTable(string $propertyName, array $objsIds, $objId) private static function deleteRelationTable(string $propertyName, array $objsIds, $objId)
{ {
/** @var string $table */ /** @var string $table */
if ( if (!empty($objsIds)
!empty($objsIds)
&& static::$hasMany[$propertyName]['table'] !== static::$table && static::$hasMany[$propertyName]['table'] !== static::$table
&& static::$hasMany[$propertyName]['table'] !== static::$hasMany[$propertyName]['mapper']::$table && static::$hasMany[$propertyName]['table'] !== static::$hasMany[$propertyName]['mapper']::$table
) { ) {
@ -1515,7 +1513,7 @@ class DataMapperAbstract implements DataMapperInterface
/** @var string $mapper */ /** @var string $mapper */
$mapper = static::$hasMany[$member]['mapper']; $mapper = static::$hasMany[$member]['mapper'];
$objects = $mapper::getArray($values, RelationType::ALL, $depth); $objects = $mapper::getArray($values, RelationType::ALL, $depth);
$obj[$member] = $objects; $obj[$member] = $objects;
} }
} }
@ -1548,13 +1546,13 @@ class DataMapperAbstract implements DataMapperInterface
/** @var string $mapper */ /** @var string $mapper */
$mapper = static::$hasOne[$member]['mapper']; $mapper = static::$hasOne[$member]['mapper'];
$id = $reflectionProperty->getValue($obj); $id = $reflectionProperty->getValue($obj);
if (self::isNullObject($id)) { if (self::isNullObject($id)) {
continue; continue;
} }
$id = is_object($id) ? self::getObjectId($id) : $id; $id = is_object($id) ? self::getObjectId($id) : $id;
$value = self::getInitialized($mapper, $id) ?? $mapper::get($id, RelationType::ALL, null, $depth); $value = self::getInitialized($mapper, $id) ?? $mapper::get($id, RelationType::ALL, null, $depth);
$reflectionProperty->setValue($obj, $value); $reflectionProperty->setValue($obj, $value);
@ -1582,7 +1580,7 @@ class DataMapperAbstract implements DataMapperInterface
{ {
foreach (static::$hasOne as $member => $one) { foreach (static::$hasOne as $member => $one) {
/** @var string $mapper */ /** @var string $mapper */
$mapper = static::$hasOne[$member]['mapper']; $mapper = static::$hasOne[$member]['mapper'];
$obj[$member] = self::getInitialized($mapper, $obj['member']) ?? $mapper::getArray($obj[$member], RelationType::ALL, $depth); $obj[$member] = self::getInitialized($mapper, $obj['member']) ?? $mapper::getArray($obj[$member], RelationType::ALL, $depth);
} }
} }
@ -1614,13 +1612,13 @@ class DataMapperAbstract implements DataMapperInterface
/** @var string $mapper */ /** @var string $mapper */
$mapper = static::$ownsOne[$member]['mapper']; $mapper = static::$ownsOne[$member]['mapper'];
$id = $reflectionProperty->getValue($obj); $id = $reflectionProperty->getValue($obj);
if (self::isNullObject($id)) { if (self::isNullObject($id)) {
continue; continue;
} }
$id = is_object($id) ? self::getObjectId($id) : $id; $id = is_object($id) ? self::getObjectId($id) : $id;
$value = self::getInitialized($mapper, $id) ?? $mapper::get($id, RelationType::ALL, null, $depth); $value = self::getInitialized($mapper, $id) ?? $mapper::get($id, RelationType::ALL, null, $depth);
$reflectionProperty->setValue($obj, $value); $reflectionProperty->setValue($obj, $value);
@ -1648,7 +1646,7 @@ class DataMapperAbstract implements DataMapperInterface
{ {
foreach (static::$ownsOne as $member => $one) { foreach (static::$ownsOne as $member => $one) {
/** @var string $mapper */ /** @var string $mapper */
$mapper = static::$ownsOne[$member]['mapper']; $mapper = static::$ownsOne[$member]['mapper'];
$obj[$member] = self::getInitialized($mapper, $obj[$member]) ?? $mapper::getArray($obj[$member], RelationType::ALL, $depth); $obj[$member] = self::getInitialized($mapper, $obj[$member]) ?? $mapper::getArray($obj[$member], RelationType::ALL, $depth);
} }
} }
@ -1680,13 +1678,13 @@ class DataMapperAbstract implements DataMapperInterface
/** @var string $mapper */ /** @var string $mapper */
$mapper = static::$belongsTo[$member]['mapper']; $mapper = static::$belongsTo[$member]['mapper'];
$id = $reflectionProperty->getValue($obj); $id = $reflectionProperty->getValue($obj);
if (self::isNullObject($id)) { if (self::isNullObject($id)) {
continue; continue;
} }
$id = is_object($id) ? self::getObjectId($id) : $id; $id = is_object($id) ? self::getObjectId($id) : $id;
$value = self::getInitialized($mapper, $id) ?? $mapper::get($id, RelationType::ALL, null, $depth); $value = self::getInitialized($mapper, $id) ?? $mapper::get($id, RelationType::ALL, null, $depth);
$reflectionProperty->setValue($obj, $value); $reflectionProperty->setValue($obj, $value);
@ -1714,7 +1712,7 @@ class DataMapperAbstract implements DataMapperInterface
{ {
foreach (static::$belongsTo as $member => $one) { foreach (static::$belongsTo as $member => $one) {
/** @var string $mapper */ /** @var string $mapper */
$mapper = static::$belongsTo[$member]['mapper']; $mapper = static::$belongsTo[$member]['mapper'];
$obj[$member] = self::getInitialized($mapper, $obj[$member]) ?? $mapper::get($obj[$member], RelationType::ALL, null, $depth); $obj[$member] = self::getInitialized($mapper, $obj[$member]) ?? $mapper::get($obj[$member], RelationType::ALL, null, $depth);
} }
} }
@ -1971,7 +1969,7 @@ class DataMapperAbstract implements DataMapperInterface
$toLoad = self::getPrimaryKeysBy($value, self::getColumnByMember($ref)); $toLoad = self::getPrimaryKeysBy($value, self::getColumnByMember($ref));
} }
$obj[$value] = self::get($toLoad, $relations, $fill, isset($depth) ? --$depth : null); $obj[$value] = self::get($toLoad, $relations, $fill, isset($depth) ? --$depth : null);
} }
$countResulsts = count($obj); $countResulsts = count($obj);

View File

@ -1,40 +1,40 @@
<?php <?php
/** /**
* Orange Management * Orange Management
* *
* PHP Version 7.1 * PHP Version 7.1
* *
* @package TBD * @package TBD
* @copyright Dennis Eichhorn * @copyright Dennis Eichhorn
* @license OMS License 1.0 * @license OMS License 1.0
* @version 1.0.0 * @version 1.0.0
* @link http://website.orange-management.de * @link http://website.orange-management.de
*/ */
declare(strict_types = 1); declare(strict_types = 1);
namespace phpOMS\DataStorage\Database\Exception; namespace phpOMS\DataStorage\Database\Exception;
/** /**
* Permission exception class. * Permission exception class.
* *
* @package Framework * @package Framework
* @license OMS License 1.0 * @license OMS License 1.0
* @link http://website.orange-management.de * @link http://website.orange-management.de
* @since 1.0.0 * @since 1.0.0
*/ */
class InvalidDatabaseTypeException extends \InvalidArgumentException class InvalidDatabaseTypeException extends \InvalidArgumentException
{ {
/** /**
* Constructor. * Constructor.
* *
* @param string $message Exception message * @param string $message Exception message
* @param int $code Exception code * @param int $code Exception code
* @param \Exception $previous Previous exception * @param \Exception $previous Previous exception
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public function __construct(string $message = '', int $code = 0, \Exception $previous = null) public function __construct(string $message = '', int $code = 0, \Exception $previous = null)
{ {
parent::__construct('Invalid database type "' . $message . '".', $code, $previous); parent::__construct('Invalid database type "' . $message . '".', $code, $previous);
} }
} }

View File

@ -237,7 +237,7 @@ abstract class GrammarAbstract
foreach ($this->specialKeywords as $keyword) { foreach ($this->specialKeywords as $keyword) {
if (strrpos($system, $keyword, -strlen($system)) !== false) { if (strrpos($system, $keyword, -strlen($system)) !== false) {
$prefix = ''; $prefix = '';
$identifier = ''; $identifier = '';
} }
} }

View File

@ -479,10 +479,10 @@ class Builder extends BuilderAbstract
} }
if (is_string($columns)) { if (is_string($columns)) {
$columns = [$columns]; $columns = [$columns];
$operator = [$operator]; $operator = [$operator];
$values = [$values]; $values = [$values];
$boolean = [$boolean]; $boolean = [$boolean];
} }
$i = 0; $i = 0;

View File

@ -17,4 +17,4 @@ namespace phpOMS\DataStorage\Database\Query;
class Expression class Expression
{ {
} }

View File

@ -30,6 +30,6 @@ abstract class QueryType extends Enum
{ {
/* public */ const SELECT = 0; /* public */ const SELECT = 0;
/* public */ const CREATE = 1; /* public */ const CREATE = 1;
/* public */ const DROP = 2; /* public */ const DROP = 2;
/* public */ const ALTER = 3; /* public */ const ALTER = 3;
} }

View File

@ -32,7 +32,7 @@ class Builder extends DatabaseQueryBuilder
private function download($uri) private function download($uri)
{ {
$finder = []; $finder = [];
$l11n = new Localization(); $l11n = new Localization();
foreach ($this->from as $from) { foreach ($this->from as $from) {
$doc = new \DOMDocument(); $doc = new \DOMDocument();
@ -52,7 +52,7 @@ class Builder extends DatabaseQueryBuilder
{ {
$finder = $this->download(); $finder = $this->download();
$result = []; $result = [];
$table = null; $table = null;
foreach ($this->wheres as $column => $where) { foreach ($this->wheres as $column => $where) {
if ($column === 'xpath') { if ($column === 'xpath') {
@ -86,7 +86,7 @@ class Builder extends DatabaseQueryBuilder
private function createTableFromList($node) : array private function createTableFromList($node) : array
{ {
$table = []; $table = [];
$children = $node->childNodes; $children = $node->childNodes;
foreach ($children as $child) { foreach ($children as $child) {

View File

@ -198,4 +198,4 @@ class Dispatcher
{ {
$this->controllers[$name] = $controller; $this->controllers[$name] = $controller;
} }
} }

View File

@ -51,7 +51,7 @@ class Fibunacci
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public static function fibunacci(int $n, int $start = 1) : int public static function fib(int $n, int $start = 1) : int
{ {
if ($n < 3) { if ($n < 3) {
return $start; return $start;
@ -83,4 +83,4 @@ class Fibunacci
{ {
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

@ -67,8 +67,9 @@ class Polygon implements D2ShapeInterface
*/ */
public function pointInPolygon(array $point) : int public function pointInPolygon(array $point) : int
{ {
$coord = $this->coord; $coord = $this->coord;
$coord[] = $this->coord[0]; $coord[] = $this->coord[0];
return self::isPointInPolygon($point, $coord); return self::isPointInPolygon($point, $coord);
} }
@ -196,7 +197,7 @@ class Polygon implements D2ShapeInterface
*/ */
private function getSignedSurface() : float private function getSignedSurface() : float
{ {
$count = count($this->coord); $count = count($this->coord);
$surface = 0; $surface = 0;
for ($i = 0; $i < $count - 1; $i++) { for ($i = 0; $i < $count - 1; $i++) {
@ -204,7 +205,6 @@ class Polygon implements D2ShapeInterface
} }
$surface += $this->coord[$count - 1]['x'] * $this->coord[0]['y'] - $this->coord[0]['x'] * $this->coord[$count - 1]['y']; $surface += $this->coord[$count - 1]['x'] * $this->coord[0]['y'] - $this->coord[0]['x'] * $this->coord[$count - 1]['y'];
$surface /= 2; $surface /= 2;
return $surface; return $surface;
@ -219,7 +219,7 @@ class Polygon implements D2ShapeInterface
*/ */
public function getPerimeter() : float public function getPerimeter() : float
{ {
$count = count($this->coord); $count = count($this->coord);
$perimeter = sqrt(($this->coord[0]['x'] - $this->coord[$count - 1]['x']) ** 2 + ($this->coord[0]['y'] - $this->coord[$count - 1]['y']) ** 2); $perimeter = sqrt(($this->coord[0]['x'] - $this->coord[$count - 1]['x']) ** 2 + ($this->coord[0]['y'] - $this->coord[$count - 1]['y']) ** 2);
for ($i = 0; $i < $count - 1; $i++) { for ($i = 0; $i < $count - 1; $i++) {
@ -239,15 +239,15 @@ class Polygon implements D2ShapeInterface
public function getBarycenter() : array public function getBarycenter() : array
{ {
$barycenter = ['x' => 0, 'y' => 0]; $barycenter = ['x' => 0, 'y' => 0];
$count = count($this->coord); $count = count($this->coord);
for ($i = 0; $i < $count - 1; $i++) { for ($i = 0; $i < $count - 1; $i++) {
$mult = ($this->coord[$i]['x'] * $this->coord[$i + 1]['y'] - $this->coord[$i + 1]['x'] * $this->coord[$i]['y']); $mult = ($this->coord[$i]['x'] * $this->coord[$i + 1]['y'] - $this->coord[$i + 1]['x'] * $this->coord[$i]['y']);
$barycenter['x'] += ($this->coord[$i]['x'] + $this->coord[$i + 1]['x']) * $mult; $barycenter['x'] += ($this->coord[$i]['x'] + $this->coord[$i + 1]['x']) * $mult;
$barycenter['y'] += ($this->coord[$i]['y'] + $this->coord[$i + 1]['y']) * $mult; $barycenter['y'] += ($this->coord[$i]['y'] + $this->coord[$i + 1]['y']) * $mult;
} }
$mult = ($this->coord[$count - 1]['x'] * $this->coord[0]['y'] - $this->coord[0]['x'] * $this->coord[$count - 1]['y']); $mult = ($this->coord[$count - 1]['x'] * $this->coord[0]['y'] - $this->coord[0]['x'] * $this->coord[$count - 1]['y']);
$barycenter['x'] += ($this->coord[$count - 1]['x'] + $this->coord[0]['x']) * $mult; $barycenter['x'] += ($this->coord[$count - 1]['x'] + $this->coord[0]['x']) * $mult;
$barycenter['y'] += ($this->coord[$count - 1]['y'] + $this->coord[0]['y']) * $mult; $barycenter['y'] += ($this->coord[$count - 1]['y'] + $this->coord[0]['y']) * $mult;

View File

@ -16,4 +16,4 @@ namespace phpOMS\Math\Geometry\Shape\D3;
class Prism implements D3ShapeInterface class Prism implements D3ShapeInterface
{ {
} }

View File

@ -17,4 +17,4 @@ namespace phpOMS\Math\Integral;
class Gauss class Gauss
{ {
} }

View File

@ -39,4 +39,4 @@ class IdentityMatrix extends Matrix
$this->matrix[$i][$i] = 1; $this->matrix[$i][$i] = 1;
} }
} }
} }

View File

@ -181,8 +181,8 @@ class Matrix implements \ArrayAccess, \Iterator
*/ */
public function setMatrix(array $matrix) : Matrix public function setMatrix(array $matrix) : Matrix
{ {
$this->m = count($matrix); $this->m = count($matrix);
$this->n = count($matrix[0] ?? 1); $this->n = count($matrix[0] ?? 1);
$this->matrix = $matrix; $this->matrix = $matrix;
return $this; return $this;
@ -568,30 +568,30 @@ class Matrix implements \ArrayAccess, \Iterator
private function gaussElimination($b) : Matrix private function gaussElimination($b) : Matrix
{ {
$mDim = count($b); $mDim = count($b);
$matrix = $this->matrix; $matrix = $this->matrix;
for ($col = 0; $col < $mDim; $col++) { for ($col = 0; $col < $mDim; $col++) {
$j = $col; $j = $col;
$max = $matrix[$j][$j]; $max = $matrix[$j][$j];
for ($i = $col + 1; $i < $mDim; $i++) { for ($i = $col + 1; $i < $mDim; $i++) {
$temp = abs($matrix[$i][$col]); $temp = abs($matrix[$i][$col]);
if ($temp > $max) { if ($temp > $max) {
$j = $i; $j = $i;
$max = $temp; $max = $temp;
} }
} }
if ($col != $j) { if ($col != $j) {
$temp = $matrix[$col]; $temp = $matrix[$col];
$matrix[$col] = $matrix[$j]; $matrix[$col] = $matrix[$j];
$matrix[$j] = $temp; $matrix[$j] = $temp;
$temp = $b[$col]; $temp = $b[$col];
$b[$col] = $b[$j]; $b[$col] = $b[$j];
$b[$j] = $temp; $b[$j] = $temp;
} }
for ($i = $col + 1; $i < $mDim; $i++) { for ($i = $col + 1; $i < $mDim; $i++) {
@ -602,7 +602,7 @@ class Matrix implements \ArrayAccess, \Iterator
} }
$matrix[$i][$col] = 0; $matrix[$i][$col] = 0;
$b[$i] -= $temp * $b[$col]; $b[$i] -= $temp * $b[$col];
} }
} }
@ -752,4 +752,4 @@ class Matrix implements \ArrayAccess, \Iterator
$row = (int) ($offset / $this->m); $row = (int) ($offset / $this->m);
unset($this->matrix[$row][$offset - $row * $this->n]); unset($this->matrix[$row][$offset - $row * $this->n]);
} }
} }

View File

@ -190,4 +190,4 @@ class QRDecomposition
return $matrix; return $matrix;
} }
} }

View File

@ -16,4 +16,4 @@ namespace phpOMS\Math\Matrix;
class SingularValueDecomposition class SingularValueDecomposition
{ {
} }

View File

@ -24,15 +24,4 @@ namespace phpOMS\Math\Matrix;
*/ */
class Vector extends Matrix class Vector extends Matrix
{ {
/** }
* Constructor.
*
* @param int $m Columns
*
* @since 1.0.0
*/
public function __construct(int $m = 1)
{
parent::__construct($m);
}
}

View File

@ -63,7 +63,7 @@ class Integer
while ($value % $prime === 0) { while ($value % $prime === 0) {
$factors[] = $prime; $factors[] = $prime;
$value /= $prime; $value /= $prime;
} }
} }
@ -98,7 +98,7 @@ class Integer
} }
$cycleSize *= 2; $cycleSize *= 2;
$y = $x; $y = $x;
} }
return $factor; return $factor;
@ -160,4 +160,4 @@ class Integer
return [(int) round($a - sqrt($b2)), (int) round($a + sqrt($b2))]; return [(int) round($a - sqrt($b2)), (int) round($a + sqrt($b2))];
} }
} }

View File

@ -37,4 +37,4 @@ class Natural
{ {
return is_int($value) && $value >= 0; return is_int($value) && $value >= 0;
} }
} }

View File

@ -35,4 +35,4 @@ abstract class NumberType extends Enum
/* public */ const N_RATIONAL = 32; /* public */ const N_RATIONAL = 32;
/* public */ const N_IRRATIONAL = 64; /* public */ const N_IRRATIONAL = 64;
/* public */ const N_COMPLEX = 128; /* public */ const N_COMPLEX = 128;
} }

View File

@ -69,4 +69,4 @@ interface EdgeInterface
* @since 1.0.0 * @since 1.0.0
*/ */
public function setVertices(VerticeInterface $a, VerticeInterface $b); public function setVertices(VerticeInterface $a, VerticeInterface $b);
} }

View File

@ -16,4 +16,4 @@ namespace phpOMS\Math\Optimization\Graph;
class FloydWarshall class FloydWarshall
{ {
} }

View File

@ -28,15 +28,15 @@ use phpOMS\Stdlib\Base\Enum;
*/ */
abstract class BrowserType extends Enum abstract class BrowserType extends Enum
{ {
/* public */ const IE = 'msie'; /* Internet Explorer */ /* public */ const IE = 'msie'; /* Internet Explorer */
/* public */ const EDGE = 'edge'; /* Internet Explorer Edge 20+ */ /* public */ const EDGE = 'edge'; /* Internet Explorer Edge 20+ */
/* public */ const FIREFOX = 'firefox'; /* Firefox */ /* public */ const FIREFOX = 'firefox'; /* Firefox */
/* public */ const SAFARI = 'safari'; /* Safari */ /* public */ const SAFARI = 'safari'; /* Safari */
/* public */ const CHROME = 'chrome'; /* Chrome */ /* public */ const CHROME = 'chrome'; /* Chrome */
/* public */ const OPERA = 'opera'; /* Opera */ /* public */ const OPERA = 'opera'; /* Opera */
/* public */ const NETSCAPE = 'netscape'; /* Netscape */ /* public */ const NETSCAPE = 'netscape'; /* Netscape */
/* public */ const MAXTHON = 'maxthon'; /* Maxthon */ /* public */ const MAXTHON = 'maxthon'; /* Maxthon */
/* public */ const KONQUEROR = 'konqueror'; /* Konqueror */ /* public */ const KONQUEROR = 'konqueror'; /* Konqueror */
/* public */ const HANDHELD = 'mobile'; /* Handheld Browser */ /* public */ const HANDHELD = 'mobile'; /* Handheld Browser */
/* public */ const BLINK = 'blink'; /* Blink Browser */ /* public */ const BLINK = 'blink'; /* Blink Browser */
} }

View File

@ -118,9 +118,9 @@ class Request extends RequestAbstract
*/ */
private function initCurrentRequest() /* : void */ private function initCurrentRequest() /* : void */
{ {
$this->uri = new Http(Http::getCurrent()); $this->uri = new Http(Http::getCurrent());
$this->data = $_GET ?? []; $this->data = $_GET ?? [];
$this->files = $_FILES ?? []; $this->files = $_FILES ?? [];
$this->header->getL11n()->setLanguage($this->loadRequestLanguage()); $this->header->getL11n()->setLanguage($this->loadRequestLanguage());
if (isset($_SERVER['CONTENT_TYPE'])) { if (isset($_SERVER['CONTENT_TYPE'])) {
@ -227,7 +227,7 @@ class Request extends RequestAbstract
public function createRequestHashs(int $start = 0) /* : void */ public function createRequestHashs(int $start = 0) /* : void */
{ {
$this->hash = []; $this->hash = [];
$pathArray = $this->uri->getPathElements(); $pathArray = $this->uri->getPathElements();
foreach ($pathArray as $key => $path) { foreach ($pathArray as $key => $path) {
$paths = []; $paths = [];
@ -372,8 +372,7 @@ class Request extends RequestAbstract
throw new \OutOfRangeException('Value "' . $port . '" is out of range.'); throw new \OutOfRangeException('Value "' . $port . '" is out of range.');
} }
return return (!empty($_SERVER['HTTPS'] ?? '') && ($_SERVER['HTTPS'] ?? '') !== 'off')
(!empty($_SERVER['HTTPS'] ?? '') && ($_SERVER['HTTPS'] ?? '') !== 'off')
|| (($_SERVER['HTTP_X_FORWARDED_PROTO'] ?? '') === 'https') || (($_SERVER['HTTP_X_FORWARDED_PROTO'] ?? '') === 'https')
|| (($_SERVER['HTTP_X_FORWARDED_SSL'] ?? '') === 'on') || (($_SERVER['HTTP_X_FORWARDED_SSL'] ?? '') === 'on')
|| ($_SERVER['SERVER_PORT'] ?? '') == $port; || ($_SERVER['SERVER_PORT'] ?? '') == $port;

View File

@ -76,10 +76,10 @@ class EmailAbstract
*/ */
public function __construct(string $host = 'localhost', int $port = 25, int $timeout = 30, bool $ssl = false) public function __construct(string $host = 'localhost', int $port = 25, int $timeout = 30, bool $ssl = false)
{ {
$this->host = $host; $this->host = $host;
$this->port = $port; $this->port = $port;
$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);
@ -488,7 +488,7 @@ class EmailAbstract
public function getMessageOverview(int $length = 0, int $start = 1) : array public function getMessageOverview(int $length = 0, int $start = 1) : array
{ {
if ($length === 0) { if ($length === 0) {
$info = imap_check($this->con); $info = imap_check($this->con);
$length = $info->Nmsgs; $length = $info->Nmsgs;
} }

View File

@ -26,8 +26,8 @@ use phpOMS\Stdlib\Base\Enum;
*/ */
abstract class RequestSource extends Enum abstract class RequestSource extends Enum
{ {
/* public */ const WEB = 0; /* This is a http request */ /* public */ const WEB = 0; /* This is a http request */
/* public */ const CONSOLE = 1; /* Request is a console command */ /* public */ const CONSOLE = 1; /* Request is a console command */
/* public */ const SOCKET = 2; /* Request through socket connection */ /* public */ const SOCKET = 2; /* Request through socket connection */
/* public */ const UNDEFINED = 3; /* Request through socket connection */ /* public */ const UNDEFINED = 3;
} }

View File

@ -26,7 +26,7 @@ use phpOMS\Stdlib\Base\Enum;
*/ */
abstract class ResponseType extends Enum abstract class ResponseType extends Enum
{ {
/* public */ const HTTP = 0; /* HTTP */ /* public */ const HTTP = 0; /* HTTP */
/* public */ const SOCKET = 1; /* Socket */ /* public */ const SOCKET = 1; /* Socket */
/* public */ const CONSOLE = 2; /* Console */ /* public */ const CONSOLE = 2; /* Console */
} }

View File

@ -185,7 +185,7 @@ class Head implements RenderableInterface
*/ */
public function render() : string public function render() : string
{ {
$head = ''; $head = '';
$head .= $this->meta->render(); $head .= $this->meta->render();
$head .= $this->renderStyle(); $head .= $this->renderStyle();
$head .= $this->renderScript(); $head .= $this->renderScript();

View File

@ -102,7 +102,7 @@ class ModuleManager
*/ */
public function __construct(ApplicationAbstract $app, string $modulePath = '') public function __construct(ApplicationAbstract $app, string $modulePath = '')
{ {
$this->app = $app; $this->app = $app;
$this->modulePath = $modulePath; $this->modulePath = $modulePath;
} }
@ -435,7 +435,7 @@ class ModuleManager
*/ */
public function reInit(string $module) /* : void */ public function reInit(string $module) /* : void */
{ {
$info = $this->loadInfo($module); $info = $this->loadInfo($module);
$class = '\\Modules\\' . $info->getDirectory() . '\\Admin\\Installer'; $class = '\\Modules\\' . $info->getDirectory() . '\\Admin\\Installer';
if (!Autoloader::exists($class)) { if (!Autoloader::exists($class)) {

View File

@ -25,6 +25,6 @@ use phpOMS\Stdlib\Base\Enum;
*/ */
abstract class ModuleStatus extends Enum abstract class ModuleStatus extends Enum
{ {
/* public */ const ACTIVE = 1; /* public */ const ACTIVE = 1;
/* public */ const INACTIVE = 2; /* public */ const INACTIVE = 2;
} }

View File

@ -26,9 +26,9 @@ use phpOMS\Stdlib\Base\Enum;
*/ */
abstract class RouteVerb extends Enum abstract class RouteVerb extends Enum
{ {
/* public */ const GET = 1; /* public */ const GET = 1;
/* public */ const PUT = 2; /* public */ const PUT = 2;
/* public */ const SET = 4; /* public */ const SET = 4;
/* public */ const DELETE = 8; /* public */ const DELETE = 8;
/* public */ const ANY = 16; /* public */ const ANY = 16;
} }

View File

@ -1,78 +1,78 @@
<?php <?php
/** /**
* Orange Management * Orange Management
* *
* PHP Version 7.1 * PHP Version 7.1
* *
* @package phpOMS\Security * @package phpOMS\Security
* @copyright Dennis Eichhorn * @copyright Dennis Eichhorn
* @license OMS License 1.0 * @license OMS License 1.0
* @version 1.0.0 * @version 1.0.0
* @link http://website.orange-management.de * @link http://website.orange-management.de
*/ */
declare(strict_types = 1); declare(strict_types = 1);
namespace phpOMS\Security; namespace phpOMS\Security;
/** /**
* Php code security class. * Php code security class.
* *
* @package phpOMS\Security * @package phpOMS\Security
* @license OMS License 1.0 * @license OMS License 1.0
* @link http://website.orange-management.de * @link http://website.orange-management.de
* @since 1.0.0 * @since 1.0.0
*/ */
class PhpCode class PhpCode
{ {
public static $deprecatedFunctions = [ public static $deprecatedFunctions = [
'apache_child_terminate', 'apache_setenv', 'define_syslog_variables', 'escapeshellarg', 'escapeshellcmd', 'eval', 'apache_child_terminate', 'apache_setenv', 'define_syslog_variables', 'escapeshellarg', 'escapeshellcmd', 'eval',
'exec', 'fp', 'fput', 'ftp_connect', 'ftp_exec', 'ftp_get', 'ftp_login', 'ftp_nb_fput', 'ftp_put', 'ftp_raw', 'exec', 'fp', 'fput', 'ftp_connect', 'ftp_exec', 'ftp_get', 'ftp_login', 'ftp_nb_fput', 'ftp_put', 'ftp_raw',
'ftp_rawlist', 'highlight_file', 'ini_alter', 'ini_get_all', 'ini_restore', 'inject_code', 'mysql_pconnect', 'ftp_rawlist', 'highlight_file', 'ini_alter', 'ini_get_all', 'ini_restore', 'inject_code', 'mysql_pconnect',
'openlog', 'passthru', 'php_uname', 'phpAds_remoteInfo', 'phpAds_XmlRpc', 'phpAds_xmlrpcDecode', 'openlog', 'passthru', 'php_uname', 'phpAds_remoteInfo', 'phpAds_XmlRpc', 'phpAds_xmlrpcDecode',
'phpAds_xmlrpcEncode', 'popen', 'posix_getpwuid', 'posix_kill', 'posix_mkfifo', 'posix_setpgid', 'posix_setsid', 'phpAds_xmlrpcEncode', 'popen', 'posix_getpwuid', 'posix_kill', 'posix_mkfifo', 'posix_setpgid', 'posix_setsid',
'posix_setuid', 'posix_uname', 'proc_close', 'proc_get_status', 'posix_setuid', 'posix_uname', 'proc_close', 'proc_get_status',
]; ];
private static function normalizeSource(string $source) : string private static function normalizeSource(string $source) : string
{ {
return str_replace(["\n", "\r\n", "\r", "\t"], ['', '', '', ' '], $source); return str_replace(["\n", "\r\n", "\r", "\t"], ['', '', '', ' '], $source);
} }
public static function hasUnicode(string $source) : bool public static function hasUnicode(string $source) : bool
{ {
return (bool) preg_match('/[^\x20-\x7f]/', $source) || !mb_check_encoding($source, 'ASCII'); return (bool) preg_match('/[^\x20-\x7f]/', $source) || !mb_check_encoding($source, 'ASCII');
} }
public static function isDisabled(array $functions) : bool public static function isDisabled(array $functions) : bool
{ {
$disabled = ini_get('disable_functions'); $disabled = ini_get('disable_functions');
$disabled = str_replace(' ', '', $disabled); $disabled = str_replace(' ', '', $disabled);
$disabled = explode(',', $disabled); $disabled = explode(',', $disabled);
foreach ($functions as $function) { foreach ($functions as $function) {
if (!in_array($function, $disabled)) { if (!in_array($function, $disabled)) {
return false; return false;
} }
} }
return true; return true;
} }
public static function hasDeprecatedFunction(string $source) : bool public static function hasDeprecatedFunction(string $source) : bool
{ {
$source = self::normalizeSource($source); $source = self::normalizeSource($source);
foreach (self::$deprecatedFunctions as $function) { foreach (self::$deprecatedFunctions as $function) {
if (preg_match('/' . $function . '\s*\(' . '/', $source) === 1) { if (preg_match('/' . $function . '\s*\(' . '/', $source) === 1) {
return true; return true;
} }
} }
return false; return false;
} }
public static function validateFileIntegrity(string $source, string $hash) : array public static function validateFileIntegrity(string $source, string $hash) : array
{ {
} }
} }

View File

@ -26,15 +26,15 @@ use phpOMS\Stdlib\Base\Enum;
*/ */
abstract class PacketType extends Enum abstract class PacketType extends Enum
{ {
/* public */ const CONNECT = 0; /* Client connection (server/sender) */ /* public */ const CONNECT = 0; /* Client connection (server/sender) */
/* public */ const DISCONNECT = 1; /* Client disconnection (server/sender) */ /* public */ const DISCONNECT = 1; /* Client disconnection (server/sender) */
/* public */ const KICK = 2; /* Kick (server/client/sender) */ /* public */ const KICK = 2; /* Kick (server/client/sender) */
/* public */ const PING = 3; /* Ping (server/sender) */ /* public */ const PING = 3; /* Ping (server/sender) */
/* public */ const HELP = 4; /* Help (server/sender) */ /* public */ const HELP = 4; /* Help (server/sender) */
/* public */ const RESTART = 5; /* Restart server (server/all clients/client) */ /* public */ const RESTART = 5; /* Restart server (server/all clients/client) */
/* public */ const MSG = 6; /* Message (server/sender/client/all clients?) */ /* public */ const MSG = 6; /* Message (server/sender/client/all clients?) */
/* public */ const LOGIN = 7; /* Login (server/sender) */ /* public */ const LOGIN = 7; /* Login (server/sender) */
/* public */ const LOGOUT = 8; /* Logout (server/sender) */ /* public */ const LOGOUT = 8; /* Logout (server/sender) */
/* public */ const ACCMODIFY = 9; /* Account modification (server/sender (admin)/user) */ /* public */ const CMD = 9; /* Other command */
/* public */ const MODULE = 999999999; /* Module packet ??? */ /* public */ const MODULE = 999999999; /* Module packet ??? */
} }

View File

@ -24,11 +24,11 @@ namespace phpOMS\Stdlib\Base;
*/ */
abstract class AddressType extends Enum abstract class AddressType extends Enum
{ {
/* public */ const HOME = 1; /* public */ const HOME = 1;
/* public */ const BUSINESS = 2; /* public */ const BUSINESS = 2;
/* public */ const SHIPPING = 3; /* public */ const SHIPPING = 3;
/* public */ const BILLING = 4; /* public */ const BILLING = 4;
/* public */ const WORK = 5; /* public */ const WORK = 5;
/* public */ const CONTRACT = 6; /* public */ const CONTRACT = 6;
/* public */ const OTHER = 7; /* public */ const OTHER = 7;
} }

View File

@ -284,4 +284,4 @@ class Iban implements \Serializable
{ {
$this->parse($serialized); $this->parse($serialized);
} }
} }

View File

@ -24,8 +24,8 @@ namespace phpOMS\Stdlib\Base;
*/ */
abstract class PhoneType extends Enum abstract class PhoneType extends Enum
{ {
/* public */ const HOME = 1; /* public */ const HOME = 1;
/* public */ const BUSINESS = 2; /* public */ const BUSINESS = 2;
/* public */ const MOBILE = 3; /* public */ const MOBILE = 3;
/* public */ const WORK = 4; /* public */ const WORK = 4;
} }

View File

@ -44,14 +44,6 @@ class SmartDateTime extends \DateTime
*/ */
/* public */ const TIMEZONE = 'UTC'; /* public */ const TIMEZONE = 'UTC';
/**
* {@inheritdoc}
*/
public function __construct($time = 'now', $timezone = null)
{
parent::__construct($time, $timezone);
}
/** /**
* Create object from DateTime * Create object from DateTime
* *
@ -264,7 +256,7 @@ class SmartDateTime extends \DateTime
$diffToWeekStart = $diffToWeekStart === 0 ? 7 : $diffToWeekStart; $diffToWeekStart = $diffToWeekStart === 0 ? 7 : $diffToWeekStart;
// get days of previous month // get days of previous month
$previousMonth = $this->createModify(0, -1); $previousMonth = $this->createModify(0, -1);
$daysPreviousMonth = $previousMonth->getDaysOfMonth(); $daysPreviousMonth = $previousMonth->getDaysOfMonth();
// add difference to $weekStartsWith counting backwards from days of previous month (reorder so that lowest value first) // add difference to $weekStartsWith counting backwards from days of previous month (reorder so that lowest value first)
@ -280,7 +272,8 @@ class SmartDateTime extends \DateTime
// add remaining days to next month (7*6 - difference+count of current month) // add remaining days to next month (7*6 - difference+count of current month)
$remainingDays = 42 - $diffToWeekStart - $daysMonth; $remainingDays = 42 - $diffToWeekStart - $daysMonth;
$nextMonth = $this->createModify(0, 1); $nextMonth = $this->createModify(0, 1);
for ($i = 1; $i <= $remainingDays; $i++) { for ($i = 1; $i <= $remainingDays; $i++) {
$days[] = new \DateTime($nextMonth->format('Y') . '-' . $nextMonth->format('m') . '-' . ($i)); $days[] = new \DateTime($nextMonth->format('Y') . '-' . $nextMonth->format('m') . '-' . ($i));
} }

View File

@ -32,8 +32,8 @@ class Edge
public function __construct(Node $node1, Node $node2, bool $directed = false) public function __construct(Node $node1, Node $node2, bool $directed = false)
{ {
$this->node1 = $node1; $this->node1 = $node1;
$this->node2 = $node2; $this->node2 = $node2;
$this->directed = $directed; $this->directed = $directed;
} }
@ -46,4 +46,4 @@ class Edge
{ {
return $this->directed; return $this->directed;
} }
} }

View File

@ -461,4 +461,4 @@ class Graph
// todo: implement // todo: implement
return true; return true;
} }
} }

View File

@ -26,4 +26,4 @@ namespace phpOMS\Stdlib\Graph;
*/ */
class Node class Node
{ {
} }

View File

@ -26,6 +26,6 @@ use phpOMS\Stdlib\Base\Enum;
*/ */
abstract class KeyType extends Enum abstract class KeyType extends Enum
{ {
/* public */ const SINGLE = 0; /* public */ const SINGLE = 0;
/* public */ const MULTIPLE = 1; /* public */ const MULTIPLE = 1;
} }

View File

@ -298,7 +298,7 @@ class MultiMap implements \Countable
return $this->remove(implode(':', $key)); return $this->remove(implode(':', $key));
} }
$keys = Permutation::permut($key); $keys = Permutation::permut($key);
$found = true; $found = true;
foreach ($keys as $key => $value) { foreach ($keys as $key => $value) {

View File

@ -26,6 +26,6 @@ use phpOMS\Stdlib\Base\Enum;
*/ */
abstract class OrderType extends Enum abstract class OrderType extends Enum
{ {
/* public */ const LOOSE = 0; /* public */ const LOOSE = 0;
/* public */ const STRICT = 1; /* public */ const STRICT = 1;
} }

View File

@ -26,10 +26,10 @@ use phpOMS\Stdlib\Base\Enum;
*/ */
abstract class PriorityMode extends Enum abstract class PriorityMode extends Enum
{ {
/* public */ const FIFO = 1; /* public */ const FIFO = 1;
/* public */ const LIFO = 2; /* public */ const LIFO = 2;
/* public */ const EARLIEST_DEADLINE = 4; /* public */ const EARLIEST_DEADLINE = 4;
/* public */ const SHORTEST_JOB = 8; /* public */ const SHORTEST_JOB = 8;
/* public */ const HIGHEST = 16; /* public */ const HIGHEST = 16;
/* public */ const LOWEST = 32; /* public */ const LOWEST = 32;
} }

View File

@ -32,4 +32,4 @@ abstract class ContentPutMode extends Enum
/* public */ const PREPEND = 2; /* public */ const PREPEND = 2;
/* public */ const REPLACE = 4; /* public */ const REPLACE = 4;
/* public */ const CREATE = 8; /* public */ const CREATE = 8;
} }

View File

@ -38,4 +38,4 @@ abstract class ExtensionType extends Enum
/* public */ const ARCHIVE = 128; /* public */ const ARCHIVE = 128;
/* public */ const PRESENTATION = 256; /* public */ const PRESENTATION = 256;
/* public */ const IMAGE = 512; /* public */ const IMAGE = 512;
} }

View File

@ -95,7 +95,7 @@ class FileUtils
if (!file_exists($origPath)) { if (!file_exists($origPath)) {
$startsWithSlash = strpos($origPath, '/') === 0 ? '/' : ''; $startsWithSlash = strpos($origPath, '/') === 0 ? '/' : '';
$path = []; $path = [];
$parts = explode('/', $origPath); $parts = explode('/', $origPath);
foreach ($parts as $part) { foreach ($parts as $part) {
@ -117,4 +117,4 @@ class FileUtils
return realpath($origPath); return realpath($origPath);
} }
} }

View File

@ -214,8 +214,8 @@ class Directory extends FileAbstract implements DirectoryInterface
public function addNode($file) : bool public function addNode($file) : bool
{ {
$this->count += $file->getCount(); $this->count += $file->getCount();
$this->size += $file->getSize(); $this->size += $file->getSize();
$this->nodes[$file->getName()] = $file; $this->nodes[$file->getName()] = $file;
return $file->createNode(); return $file->createNode();
@ -338,4 +338,4 @@ class Directory extends FileAbstract implements DirectoryInterface
{ {
// TODO: Implement offsetGet() method. // TODO: Implement offsetGet() method.
} }
} }

View File

@ -83,7 +83,7 @@ class File extends FileAbstract implements FileInterface
public static function put(string $path, string $content, int $mode = ContentPutMode::REPLACE | ContentPutMode::CREATE) : bool public static function put(string $path, string $content, int $mode = ContentPutMode::REPLACE | ContentPutMode::CREATE) : bool
{ {
$http = new Http($path); $http = new Http($path);
$con = self::ftpConnect($http); $con = self::ftpConnect($http);
if (ftp_pwd($con) !== $http->getPath()) { if (ftp_pwd($con) !== $http->getPath()) {
return false; return false;
@ -561,4 +561,4 @@ class File extends FileAbstract implements FileInterface
{ {
// TODO: Implement getExtension() method. // TODO: Implement getExtension() method.
} }
} }

View File

@ -32,7 +32,8 @@ class FtpStorage extends StorageAbstract
{ {
private static $instance = null; private static $instance = null;
public function __construct() { public function __construct()
{
} }
@ -141,4 +142,4 @@ class FtpStorage extends StorageAbstract
return File::extension($path); return File::extension($path);
} }
} }

View File

@ -13,6 +13,7 @@
declare(strict_types = 1); declare(strict_types = 1);
namespace phpOMS\System\File\Local; namespace phpOMS\System\File\Local;
use phpOMS\System\File\StorageAbstract; use phpOMS\System\File\StorageAbstract;
use phpOMS\System\File\PathException; use phpOMS\System\File\PathException;
@ -166,4 +167,4 @@ class LocalStorage extends StorageAbstract
return File::extension($path); return File::extension($path);
} }
} }

View File

@ -278,9 +278,9 @@ abstract class C128Abstract
$checksum = static::$CHECKSUM; $checksum = static::$CHECKSUM;
for ($pos = 1; $pos <= $length; $pos++) { for ($pos = 1; $pos <= $length; $pos++) {
$activeKey = substr($this->content, ($pos - 1), 1); $activeKey = substr($this->content, ($pos - 1), 1);
$codeString .= static::$CODEARRAY[$activeKey]; $codeString .= static::$CODEARRAY[$activeKey];
$checksum += $values[$activeKey] * $pos; $checksum += $values[$activeKey] * $pos;
} }
$codeString .= static::$CODEARRAY[$keys[($checksum - (intval($checksum / 103) * 103))]]; $codeString .= static::$CODEARRAY[$keys[($checksum - (intval($checksum / 103) * 103))]];
@ -348,7 +348,9 @@ abstract class C128Abstract
private function calculateCodeLength(string $codeString) : int private function calculateCodeLength(string $codeString) : int
{ {
$codeLength = 0; $codeLength = 0;
for ($i = 1; $i <= strlen($codeString); $i++) { $length = strlen($codeString);
for ($i = 1; $i <= $length; $i++) {
$codeLength = $codeLength + (int) (substr($codeString, ($i - 1), 1)); $codeLength = $codeLength + (int) (substr($codeString, ($i - 1), 1));
} }

View File

@ -61,23 +61,6 @@ class C39 extends C128Abstract
*/ */
protected static $CODE_END = '121121211'; protected static $CODE_END = '121121211';
/**
* Constructor
*
* @param string $content Content to encrypt
* @param int $width Barcode width
* @param int $height Barcode height
* @param int $orientation Orientation of the barcode
*
* @todo : add mirror parameter
*
* @since 1.0.0
*/
public function __construct(string $content = '', int $width = 100, int $height = 20, int $orientation = OrientationType::HORIZONTAL)
{
parent::__construct($content, $width, $height, $orientation);
}
/** /**
* Set content to encrypt * Set content to encrypt
* *

View File

@ -238,7 +238,7 @@ class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
public function testDiscountedPaybackPeriod() public function testDiscountedPaybackPeriod()
{ {
$O1 = 5000; $O1 = 5000;
$r = 0.05; $r = 0.05;
$CF = 1000; $CF = 1000;
self::assertTrue(abs(5.896 - FinanceFormulas::getDiscountedPaybackPeriod($CF, $O1, $r)) < 0.01); self::assertTrue(abs(5.896 - FinanceFormulas::getDiscountedPaybackPeriod($CF, $O1, $r)) < 0.01);

View File

@ -25,11 +25,11 @@ class FibunacciTest extends \PHPUnit\Framework\TestCase
self::assertFalse(Fibunacci::isFibunacci(6)); self::assertFalse(Fibunacci::isFibunacci(6));
self::assertFalse(Fibunacci::isFibunacci(87)); self::assertFalse(Fibunacci::isFibunacci(87));
self::assertEquals(1, Fibunacci::fibunacci(1)); self::assertEquals(1, Fibunacci::fib(1));
self::assertTrue(Fibunacci::isFibunacci(Fibunacci::binet(3))); self::assertTrue(Fibunacci::isFibunacci(Fibunacci::binet(3)));
self::assertTrue(Fibunacci::isFibunacci(Fibunacci::binet(6))); self::assertTrue(Fibunacci::isFibunacci(Fibunacci::binet(6)));
self::assertEquals(Fibunacci::binet(6), Fibunacci::fibunacci(6)); self::assertEquals(Fibunacci::binet(6), Fibunacci::fib(6));
self::assertEquals(Fibunacci::binet(8), Fibunacci::fibunacci(8)); self::assertEquals(Fibunacci::binet(8), Fibunacci::fib(8));
} }
} }

View File

@ -19,7 +19,7 @@ class LZWTest extends \PHPUnit\Framework\TestCase
{ {
public function testLZW() public function testLZW()
{ {
$expected = 'This is a test'; $expected = 'This is a test';
$compression = new LZW(); $compression = new LZW();
self::assertEquals($expected, $compression->decompress($compression->compress($expected))); self::assertEquals($expected, $compression->decompress($compression->compress($expected)));
} }

View File

@ -21,4 +21,4 @@ class SchedulerAbstractTest extends \PHPUnit\Framework\TestCase
{ {
self::assertEquals('', SchedulerAbstract::getBin()); self::assertEquals('', SchedulerAbstract::getBin());
} }
} }