Finalize new tests

This commit is contained in:
Dennis Eichhorn 2018-01-15 18:51:11 +01:00
parent b326f71086
commit 58e6b89768
453 changed files with 497 additions and 841 deletions

View File

@ -21,9 +21,9 @@ use phpOMS\Validation\Network\Email;
/** /**
* Account class. * Account class.
* *
* The account class is the base model for accounts. This model contains the most common account * The account class is the base model for accounts. This model contains the most common account
* information. This model is not comparable to a profile which contains much more information. * information. This model is not comparable to a profile which contains much more information.
* *
* @package phpOMS\Account * @package phpOMS\Account
* @license OMS License 1.0 * @license OMS License 1.0
@ -157,7 +157,7 @@ class Account implements ArrayableInterface, \JsonSerializable
/** /**
* Constructor. * Constructor.
* *
* The constructor automatically sets the created date as well as the last activity to now. * The constructor automatically sets the created date as well as the last activity to now.
* *
* @param int $id Account id * @param int $id Account id
@ -186,7 +186,7 @@ class Account implements ArrayableInterface, \JsonSerializable
/** /**
* Get localization. * Get localization.
* *
* Every account can have a different localization which can be accessed here. * Every account can have a different localization which can be accessed here.
* *
* @return Localization * @return Localization
@ -200,8 +200,8 @@ class Account implements ArrayableInterface, \JsonSerializable
/** /**
* Get groups. * Get groups.
* *
* Every account can belong to multiple groups. * Every account can belong to multiple groups.
* These groups usually are used for permissions and categorize accounts. * These groups usually are used for permissions and categorize accounts.
* *
* @return array Returns array of all groups * @return array Returns array of all groups
@ -215,9 +215,9 @@ class Account implements ArrayableInterface, \JsonSerializable
/** /**
* Add group. * Add group.
* *
* @param mixed $group Group to add * @param mixed $group Group to add
* *
* @return void * @return void
* *
* @since 1.0.0 * @since 1.0.0
@ -243,7 +243,7 @@ class Account implements ArrayableInterface, \JsonSerializable
/** /**
* Set permissions. * Set permissions.
* *
* The method accepts an array of permissions. All existing permissions are replaced. * The method accepts an array of permissions. All existing permissions are replaced.
* *
* @param PermissionAbstract[] $permissions * @param PermissionAbstract[] $permissions
@ -259,7 +259,7 @@ class Account implements ArrayableInterface, \JsonSerializable
/** /**
* Add permissions. * Add permissions.
* *
* Adds permissions to the account * Adds permissions to the account
* *
* @param PermissionAbstract[] $permissions Array of permissions to add to the account * @param PermissionAbstract[] $permissions Array of permissions to add to the account
@ -275,7 +275,7 @@ class Account implements ArrayableInterface, \JsonSerializable
/** /**
* Add permission. * Add permission.
* *
* Adds a single permission to the account * Adds a single permission to the account
* *
* @param PermissionAbstract $permission Permission to add to the account * @param PermissionAbstract $permission Permission to add to the account
@ -291,7 +291,7 @@ class Account implements ArrayableInterface, \JsonSerializable
/** /**
* Get permissions. * Get permissions.
* *
* @return array * @return array
* *
* @since 1.0.0 * @since 1.0.0
@ -305,7 +305,7 @@ class Account implements ArrayableInterface, \JsonSerializable
* Has permissions. * Has permissions.
* *
* Checks if the account has a permission defined * Checks if the account has a permission defined
* *
* @param int $permission Permission to check * @param int $permission Permission to check
* @param int $unit Unit Unit to check (null if all are acceptable) * @param int $unit Unit Unit to check (null if all are acceptable)
* @param string $app App App to check (null if all are acceptable) * @param string $app App App to check (null if all are acceptable)
@ -324,11 +324,11 @@ class Account implements ArrayableInterface, \JsonSerializable
foreach ($this->permissions as $p) { foreach ($this->permissions as $p) {
if (($p->getUnit() === $unit || $p->getUnit() === null || !isset($unit)) if (($p->getUnit() === $unit || $p->getUnit() === null || !isset($unit))
&& ($p->getApp() === $app || $p->getApp() === null || !isset($app)) && ($p->getApp() === $app || $p->getApp() === null || !isset($app))
&& ($p->getModule() === $module || $p->getModule() === null || !isset($module)) && ($p->getModule() === $module || $p->getModule() === null || !isset($module))
&& ($p->getType() === $type || $p->getType() === null || !isset($type)) && ($p->getType() === $type || $p->getType() === null || !isset($type))
&& ($p->getElement() === $element || $p->getElement() === null || !isset($element)) && ($p->getElement() === $element || $p->getElement() === null || !isset($element))
&& ($p->getComponent() === $component || $p->getComponent() === null || !isset($component)) && ($p->getComponent() === $component || $p->getComponent() === null || !isset($component))
&& ($p->getPermission() | $permission) === $p->getPermission()) { && ($p->getPermission() | $permission) === $p->getPermission()) {
return true; return true;
} }
@ -445,7 +445,7 @@ class Account implements ArrayableInterface, \JsonSerializable
* @param string $email Email * @param string $email Email
* *
* @return void * @return void
* *
* @throws \InvalidArgumentException Exception is thrown if the provided string is not a valid email * @throws \InvalidArgumentException Exception is thrown if the provided string is not a valid email
* *
* @since 1.0.0 * @since 1.0.0
@ -553,7 +553,7 @@ class Account implements ArrayableInterface, \JsonSerializable
* @param string $password Password * @param string $password Password
* *
* @return void * @return void
* *
* @throws \Exception * @throws \Exception
* *
* @since 1.0.0 * @since 1.0.0
@ -628,7 +628,7 @@ class Account implements ArrayableInterface, \JsonSerializable
/** /**
* Json serialize. * Json serialize.
* *
* @return array * @return array
* *
* @since 1.0.0 * @since 1.0.0

View File

@ -19,8 +19,8 @@ use phpOMS\DataStorage\Session\SessionInterface;
/** /**
* Account manager class. * Account manager class.
* *
* The account manager is used to manage multiple accounts. * The account manager is used to manage multiple accounts.
* *
* @package phpOMS\Account * @package phpOMS\Account
* @license OMS License 1.0 * @license OMS License 1.0

View File

@ -16,7 +16,7 @@ namespace phpOMS\Account;
/** /**
* Permission class. * Permission class.
* *
* This permission abstract is the basis for all permissions. Contrary to it's name it is not an * This permission abstract is the basis for all permissions. Contrary to it's name it is not an
* abstract class and can be used directly if needed. * abstract class and can be used directly if needed.
* *
@ -342,7 +342,7 @@ class PermissionAbstract
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public function hasPermission(int $permission) : bool public function hasPermission(int $permission) : bool
{ {
return ($this->permission | $permission) === $this->permission; return ($this->permission | $permission) === $this->permission;
} }

View File

@ -155,7 +155,7 @@ class ApplicationAbstract
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public function __set($name, $value) public function __set($name, $value)
{ {
if (!empty($this->$name)) { if (!empty($this->$name)) {
return; return;
@ -175,8 +175,8 @@ class ApplicationAbstract
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public function __get($name) public function __get($name)
{ {
return $this->$name; return $this->$name;
} }
} }

View File

@ -16,7 +16,7 @@ namespace phpOMS\Business\Marketing;
/** /**
* Marketing Metrics * Marketing Metrics
* *
* This class provided basic marketing metric calculations * This class provided basic marketing metric calculations
* *
* @package phpOMS\Business\Marketing * @package phpOMS\Business\Marketing
@ -27,9 +27,9 @@ namespace phpOMS\Business\Marketing;
class Metrics { class Metrics {
/** /**
* Calculate customer retention * Calculate customer retention
* *
* @latex r = \frac{ce - cn}{cs} * @latex r = \frac{ce - cn}{cs}
* *
* @param int $ce Customer at the end of the period * @param int $ce Customer at the end of the period
* @param int $cn New customers during period * @param int $cn New customers during period
* @param int $cs Customers at the start of the period * @param int $cs Customers at the start of the period

View File

@ -16,8 +16,8 @@ namespace phpOMS\Business\Marketing;
/** /**
* Net Promoter Score * Net Promoter Score
* *
* The net promoter score is a basic evaluation of the happiness of customers. * The net promoter score is a basic evaluation of the happiness of customers.
* Instead of customers the NPS can also be transferred to non-customers. * Instead of customers the NPS can also be transferred to non-customers.
* *
* @package phpOMS\Business\Marketing * @package phpOMS\Business\Marketing

View File

@ -16,7 +16,7 @@ namespace phpOMS\Business\Programming;
/** /**
* Programming metrics * Programming metrics
* *
* This class provides basic programming metric calculations. * This class provides basic programming metric calculations.
* *
* @package phpOMS\Business\Programming * @package phpOMS\Business\Programming

View File

@ -16,8 +16,8 @@ namespace phpOMS\Business\Sales;
/** /**
* Market share calculations (Zipf function) * Market share calculations (Zipf function)
* *
* This class can be used to calculate the market share based on a rank or vice versa * This class can be used to calculate the market share based on a rank or vice versa
* the rank based on a marketshare in a Zipf distributed market. * the rank based on a marketshare in a Zipf distributed market.
* *
* @package phpOMS\Business\Sales * @package phpOMS\Business\Sales
@ -45,10 +45,10 @@ class MarketShareEstimation {
for ($i = 0; $i < $participants; $i++) { for ($i = 0; $i < $participants; $i++) {
$sum += 1 / pow($i + 1, $modifier); $sum += 1 / pow($i + 1, $modifier);
} }
return (int) round(pow(1 / ($marketShare * $sum), 1 / $modifier)); return (int) round(pow(1 / ($marketShare * $sum), 1 / $modifier));
} }
/** /**
* Calculate market share (m) based on rank (r) * Calculate market share (m) based on rank (r)
* *
@ -68,7 +68,7 @@ class MarketShareEstimation {
for ($i = 0; $i < $participants; $i++) { for ($i = 0; $i < $participants; $i++) {
$sum += 1 / pow($i + 1, $modifier); $sum += 1 / pow($i + 1, $modifier);
} }
return (1 / pow($rank, $modifier)) / $sum; return (1 / pow($rank, $modifier)) / $sum;
} }
} }

View File

@ -276,7 +276,7 @@ class FileCache implements CacheInterface
if (!File::exists($path)) { if (!File::exists($path)) {
return null; return null;
} }
$created = Directory::created($path)->getTimestamp(); $created = Directory::created($path)->getTimestamp();
$now = time(); $now = time();
@ -300,7 +300,7 @@ class FileCache implements CacheInterface
return $this->parseValue($type, $raw, $expireEnd); return $this->parseValue($type, $raw, $expireEnd);
} }
private function parseValue(int $type, string $raw, int $expireEnd) private function parseValue(int $type, string $raw, int $expireEnd)
{ {
$value = null; $value = null;

View File

@ -40,7 +40,7 @@ class MemCache implements CacheInterface
* @since 1.0.0 * @since 1.0.0
*/ */
private $threshold = 10; private $threshold = 10;
private $status; private $status;
/** /**

View File

@ -57,7 +57,7 @@ class MysqlConnection extends ConnectionAbstract
public function connect(array $dbdata = null) /* : void */ public function connect(array $dbdata = null) /* : void */
{ {
$this->dbdata = isset($dbdata) ? $dbdata : $this->dbdata; $this->dbdata = isset($dbdata) ? $dbdata : $this->dbdata;
if (!isset($this->dbdata['db'], $this->dbdata['host'], $this->dbdata['port'], $this->dbdata['database'], $this->dbdata['login'], $this->dbdata['password'])) { if (!isset($this->dbdata['db'], $this->dbdata['host'], $this->dbdata['port'], $this->dbdata['database'], $this->dbdata['login'], $this->dbdata['password'])) {
throw new InvalidConnectionConfigException(json_encode($this->dbdata)); throw new InvalidConnectionConfigException(json_encode($this->dbdata));
} }

View File

@ -180,7 +180,7 @@ class DataMapperAbstract implements DataMapperInterface
/** /**
* Clone. * Clone.
* *
* @return void * @return void
* *
* @since 1.0.0 * @since 1.0.0
@ -194,7 +194,7 @@ class DataMapperAbstract implements DataMapperInterface
* Set database connection. * Set database connection.
* *
* @param ConnectionAbstract $con Database connection * @param ConnectionAbstract $con Database connection
* *
* @return void * @return void
* *
* @since 1.0.0 * @since 1.0.0
@ -499,7 +499,7 @@ class DataMapperAbstract implements DataMapperInterface
* *
* @since 1.0.0 * @since 1.0.0
*/ */
private static function getObjectId($obj, \ReflectionClass $reflectionClass = null) private static function getObjectId($obj, \ReflectionClass $reflectionClass = null)
{ {
$reflectionClass = $reflectionClass ?? new \ReflectionClass($obj); $reflectionClass = $reflectionClass ?? new \ReflectionClass($obj);
$reflectionProperty = $reflectionClass->getProperty(static::$columns[static::$primaryField]['internal']); $reflectionProperty = $reflectionClass->getProperty(static::$columns[static::$primaryField]['internal']);
@ -918,8 +918,8 @@ class DataMapperAbstract implements DataMapperInterface
$objsIds[$propertyName][$key] = $value; $objsIds[$propertyName][$key] = $value;
continue; continue;
} }
if (!isset($relReflectionClass)) { if (!isset($relReflectionClass)) {
$relReflectionClass = new \ReflectionClass($value); $relReflectionClass = new \ReflectionClass($value);
} }
@ -1168,7 +1168,7 @@ class DataMapperAbstract implements DataMapperInterface
if ($relations === RelationType::ALL) { if ($relations === RelationType::ALL) {
self::updateHasMany($reflectionClass, $obj, $objId); self::updateHasMany($reflectionClass, $obj, $objId);
} }
if ($update) { if ($update) {
self::updateModel($obj, $objId, $reflectionClass); self::updateModel($obj, $objId, $reflectionClass);
} }
@ -1220,8 +1220,8 @@ class DataMapperAbstract implements DataMapperInterface
$objsIds[$key] = $value; $objsIds[$key] = $value;
continue; continue;
} }
if (!isset($relReflectionClass)) { if (!isset($relReflectionClass)) {
$relReflectionClass = new \ReflectionClass($value); $relReflectionClass = new \ReflectionClass($value);
} }
@ -1240,7 +1240,7 @@ class DataMapperAbstract implements DataMapperInterface
} }
// todo: could be a problem, relation needs to be removed first?! // todo: could be a problem, relation needs to be removed first?!
} }
self::deleteRelationTable($propertyName, $objsIds, $objId); self::deleteRelationTable($propertyName, $objsIds, $objId);
@ -1332,7 +1332,7 @@ class DataMapperAbstract implements DataMapperInterface
// todo: the order of deletion could be a problem. maybe looping through ownsOne and belongsTo first is better. // todo: the order of deletion could be a problem. maybe looping through ownsOne and belongsTo first is better.
// todo: support other relation types as well (belongsto, ownsone) = for better control // todo: support other relation types as well (belongsto, ownsone) = for better control
foreach (static::$columns as $key => $column) { foreach (static::$columns as $key => $column) {
if ($relations === RelationType::ALL && isset(static::$ownsOne[$propertyName]) && $column['internal'] === $propertyName) { if ($relations === RelationType::ALL && isset(static::$ownsOne[$propertyName]) && $column['internal'] === $propertyName) {
self::deleteOwnsOne($propertyName, $property->getValue($obj)); self::deleteOwnsOne($propertyName, $property->getValue($obj));
@ -1378,7 +1378,7 @@ class DataMapperAbstract implements DataMapperInterface
if ($relations !== RelationType::NONE) { if ($relations !== RelationType::NONE) {
self::deleteHasMany($reflectionClass, $obj, $objId, $relations); self::deleteHasMany($reflectionClass, $obj, $objId, $relations);
} }
self::deleteModel($obj, $objId, $relations, $reflectionClass); self::deleteModel($obj, $objId, $relations, $reflectionClass);
return $objId; return $objId;
@ -1467,7 +1467,7 @@ class DataMapperAbstract implements DataMapperInterface
* @param array[] $result Result set * @param array[] $result Result set
* @param mixed $obj Object to add the relations to * @param mixed $obj Object to add the relations to
* @param int $depth Relation depth * @param int $depth Relation depth
* *
* @return void * @return void
* *
* @since 1.0.0 * @since 1.0.0
@ -1526,7 +1526,7 @@ class DataMapperAbstract implements DataMapperInterface
* *
* @param mixed $obj Object to add the relations to * @param mixed $obj Object to add the relations to
* @param int $depth Relation depth * @param int $depth Relation depth
* *
* @return void * @return void
* *
* @todo accept reflection class as parameter * @todo accept reflection class as parameter
@ -1549,11 +1549,11 @@ 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);
@ -1658,7 +1658,7 @@ class DataMapperAbstract implements DataMapperInterface
* *
* @param mixed $obj Object to add the relations to * @param mixed $obj Object to add the relations to
* @param int $depth Relation depth * @param int $depth Relation depth
* *
* @return void * @return void
* *
* @todo accept reflection class as parameter * @todo accept reflection class as parameter
@ -1736,7 +1736,7 @@ class DataMapperAbstract implements DataMapperInterface
$reflectionClass = new \ReflectionClass($obj); $reflectionClass = new \ReflectionClass($obj);
foreach ($result as $column => $value) { foreach ($result as $column => $value) {
if (!isset(static::$columns[$column]['internal']) /* && $reflectionClass->hasProperty(static::$columns[$column]['internal']) */) { if (!isset(static::$columns[$column]['internal']) /* && $reflectionClass->hasProperty(static::$columns[$column]['internal']) */) {
continue; continue;
} }
@ -1815,7 +1815,7 @@ class DataMapperAbstract implements DataMapperInterface
* @param int $depth Relation depth * @param int $depth Relation depth
* *
* @return mixed * @return mixed
* *
* @todo: implement language * @todo: implement language
* *
* @since 1.0.0 * @since 1.0.0
@ -2578,7 +2578,7 @@ class DataMapperAbstract implements DataMapperInterface
* *
* @since 1.0.0 * @since 1.0.0
*/ */
private static function getInitialized(string $mapper, $id) private static function getInitialized(string $mapper, $id)
{ {
return self::$initObjects[$mapper][$id] ?? null; return self::$initObjects[$mapper][$id] ?? null;
} }
@ -2631,7 +2631,7 @@ class DataMapperAbstract implements DataMapperInterface
$sth = self::$db->con->prepare($query->toSql()); $sth = self::$db->con->prepare($query->toSql());
$sth->execute(); $sth->execute();
$results = $sth->fetchAll(\PDO::FETCH_ASSOC); $results = $sth->fetchAll(\PDO::FETCH_ASSOC);
return count($results) === 0; return count($results) === 0;
@ -2643,7 +2643,7 @@ class DataMapperAbstract implements DataMapperInterface
* @param string $name member name * @param string $name member name
* *
* @return string * @return string
* *
* @throws \Exception Throws this exception if the member couldn't be found * @throws \Exception Throws this exception if the member couldn't be found
* *
* @since 1.0.0 * @since 1.0.0
@ -2665,7 +2665,7 @@ class DataMapperAbstract implements DataMapperInterface
* @param object $obj Object to check * @param object $obj Object to check
* *
* @return bool * @return bool
* *
* @since 1.0.0 * @since 1.0.0
*/ */
private static function isNullObject($obj) : bool private static function isNullObject($obj) : bool

View File

@ -234,7 +234,7 @@ abstract class GrammarAbstract
{ {
// todo: this is a bad way to handle select count(*) which doesn't need a prefix. Maybe remove prefixes in total? // todo: this is a bad way to handle select count(*) which doesn't need a prefix. Maybe remove prefixes in total?
$identifier = $this->systemIdentifier; $identifier = $this->systemIdentifier;
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 = '';

View File

@ -377,7 +377,7 @@ class Builder extends BuilderAbstract
$test = strtolower($raw); $test = strtolower($raw);
if (strpos($test, 'insert') !== false if (strpos($test, 'insert') !== false
|| strpos($test, 'update') !== false || strpos($test, 'update') !== false
|| strpos($test, 'drop') !== false || strpos($test, 'drop') !== false
|| strpos($test, 'delete') !== false || strpos($test, 'delete') !== false
@ -1120,18 +1120,18 @@ class Builder extends BuilderAbstract
public function execute() public function execute()
{ {
$sth = $this->connection->con->prepare($this->toSql()); $sth = $this->connection->con->prepare($this->toSql());
foreach ($this->binds as $key => $bind) { foreach ($this->binds as $key => $bind) {
$type = self::getBindParamType($bind); $type = self::getBindParamType($bind);
$sth->bindParam($key, $bind, $type); $sth->bindParam($key, $bind, $type);
} }
$sth->execute(); $sth->execute();
return $sth; return $sth;
} }
/** /**
* Get bind parameter type. * Get bind parameter type.
* *
@ -1150,7 +1150,7 @@ class Builder extends BuilderAbstract
} elseif (is_string($value) || is_float($value)) { } elseif (is_string($value) || is_float($value)) {
return \PDO::PARAM_STR; return \PDO::PARAM_STR;
} }
throw new \Exception(); throw new \Exception();
} }

View File

@ -118,7 +118,7 @@ class Grammar extends GrammarAbstract
} }
$components = $this->getComponents($query->getType()); $components = $this->getComponents($query->getType());
/* Loop all possible query components and if they exist compile them. */ /* Loop all possible query components and if they exist compile them. */
foreach ($components as $component) { foreach ($components as $component) {
if (isset($query->{$component}) && !empty($query->{$component})) { if (isset($query->{$component}) && !empty($query->{$component})) {
@ -192,7 +192,7 @@ class Grammar extends GrammarAbstract
protected function compileUpdates(Builder $query, array $table) : string protected function compileUpdates(Builder $query, array $table) : string
{ {
$expression = $this->expressionizeTable($table, $query->getPrefix()); $expression = $this->expressionizeTable($table, $query->getPrefix());
if ($expression === '') { if ($expression === '') {
return ''; return '';
} }

View File

@ -52,7 +52,7 @@ class HttpSession implements SessionInterface
* @since 1.0.0 * @since 1.0.0
*/ */
private $sid = null; private $sid = null;
/** /**
* Inactivity Interval. * Inactivity Interval.
* *
@ -85,23 +85,23 @@ class HttpSession implements SessionInterface
if (!is_bool($sid)) { if (!is_bool($sid)) {
session_id($sid); session_id($sid);
} }
$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();
} }
if ($this->inactivityInterval > 0 && ($this->inactivityInterval + ($_SESSION['lastActivity'] ?? 0) < time())) { if ($this->inactivityInterval > 0 && ($this->inactivityInterval + ($_SESSION['lastActivity'] ?? 0) < time())) {
$this->destroy(); $this->destroy();
} }
$this->sessionData = $_SESSION; $this->sessionData = $_SESSION;
$_SESSION = null; $_SESSION = null;
$this->sessionData['lastActivity'] = time(); $this->sessionData['lastActivity'] = time();
$this->sid = session_id(); $this->sid = session_id();
$this->setCsrfProtection(); $this->setCsrfProtection();
} }
@ -204,7 +204,7 @@ class HttpSession implements SessionInterface
{ {
$this->sid = $sid; $this->sid = $sid;
} }
/** /**
* Destroy the current session. * Destroy the current session.
* *

View File

@ -91,7 +91,7 @@ interface SessionInterface
/** /**
* Lock session from further adjustments. * Lock session from further adjustments.
* *
* @return void * @return void
* *
* @since 1.0.0 * @since 1.0.0

View File

@ -33,7 +33,7 @@ class Builder extends DatabaseQueryBuilder
{ {
$finder = []; $finder = [];
$l11n = new Localization(); $l11n = new Localization();
foreach ($this->from as $from) { foreach ($this->from as $from) {
$doc = new \DOMDocument(); $doc = new \DOMDocument();
$doc->loadHTML(Rest::request($l11n, new Http($from))); $doc->loadHTML(Rest::request($l11n, new Http($from)));
@ -42,12 +42,12 @@ class Builder extends DatabaseQueryBuilder
return $finder; return $finder;
} }
public function get(string $xpath) public function get(string $xpath)
{ {
$nodes = $finder->query($xpath); $nodes = $finder->query($xpath);
} }
public function execute() public function execute()
{ {
$finder = $this->download(); $finder = $this->download();
@ -92,7 +92,7 @@ class Builder extends DatabaseQueryBuilder
foreach ($children as $child) { foreach ($children as $child) {
$table[] = $child->asXML(); $table[] = $child->asXML();
} }
return $table; return $table;
} }

View File

@ -131,7 +131,7 @@ class L11nManager
} elseif (isset($this->language[$language], $this->language[$language][$module])) { } elseif (isset($this->language[$language], $this->language[$language][$module])) {
return $this->language[$language][$module]; return $this->language[$language][$module];
} }
return []; return [];
} }

View File

@ -219,7 +219,7 @@ class Localization
public function setLanguage(string $language) /* : void */ public function setLanguage(string $language) /* : void */
{ {
$language = strtolower($language); $language = strtolower($language);
if (!ISO639x1Enum::isValidValue($language)) { if (!ISO639x1Enum::isValidValue($language)) {
throw new InvalidEnumValue($language); throw new InvalidEnumValue($language);
} }

View File

@ -208,7 +208,7 @@ class Money implements \Serializable
$this->value += $value; $this->value += $value;
} elseif ($value instanceof Money) { } elseif ($value instanceof Money) {
$this->value += $value->getInt(); $this->value += $value->getInt();
} }
return $this; return $this;
} }
@ -242,7 +242,7 @@ class Money implements \Serializable
$this->value -= $value; $this->value -= $value;
} elseif ($value instanceof Money) { } elseif ($value instanceof Money) {
$this->value -= $value->getInt(); $this->value -= $value->getInt();
} }
return $this; return $this;
} }

View File

@ -79,7 +79,7 @@ class Polygon implements D2ShapeInterface
* @param array $polygon Polygon definition * @param array $polygon Polygon definition
* *
* @return int -1 inside polygon 0 on vertice 1 outside * @return int -1 inside polygon 0 on vertice 1 outside
* *
* @link http://erich.realtimerendering.com/ptinpoly/ * @link http://erich.realtimerendering.com/ptinpoly/
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -88,18 +88,18 @@ class CholeskyDecomposition
for ($i = 0; $i < $k ; $i++) { for ($i = 0; $i < $k ; $i++) {
$X[$k][$j] -= $X[$i][$j] * $this->L[$k][$i]; $X[$k][$j] -= $X[$i][$j] * $this->L[$k][$i];
} }
$X[$k][$j] /= $this->L[$k][$k]; $X[$k][$j] /= $this->L[$k][$k];
} }
} }
// Solve L'*X = Y; // Solve L'*X = Y;
for ($k = $this->m - 1; $k >= 0; $k--) { for ($k = $this->m - 1; $k >= 0; $k--) {
for ($j = 0; $j < $n; $j++) { for ($j = 0; $j < $n; $j++) {
for ($i = $k + 1; $i < $this->m ; $i++) { for ($i = $k + 1; $i < $this->m ; $i++) {
$X[$k][$j] -= $X[$i][$j] * $this->L[$i][$k]; $X[$k][$j] -= $X[$i][$j] * $this->L[$i][$k];
} }
$X[$k][$j] /= $this->L[$k][$k]; $X[$k][$j] /= $this->L[$k][$k];
} }
} }

View File

@ -97,7 +97,7 @@ class LUDecomposition
} }
} }
} }
$matrix = new Matrix(); $matrix = new Matrix();
$matrix->setMatrix($L); $matrix->setMatrix($L);
@ -117,7 +117,7 @@ class LUDecomposition
} }
} }
} }
$matrix = new Matrix(); $matrix = new Matrix();
$matrix->setMatrix($U); $matrix->setMatrix($U);
@ -136,11 +136,11 @@ class LUDecomposition
return false; return false;
} }
} }
return true; return true;
} }
public function det() public function det()
{ {
$d = $this->pivSign; $d = $this->pivSign;
for ($j = 0; $j < $this->n; ++$j) { for ($j = 0; $j < $this->n; ++$j) {

View File

@ -173,7 +173,7 @@ class Matrix implements \ArrayAccess, \Iterator
* *
* @param array $matrix Matrix * @param array $matrix Matrix
* *
* @return Matrix * @return Matrix
* *
* @throws \Exception * @throws \Exception
* *
@ -566,7 +566,7 @@ class Matrix implements \ArrayAccess, \Iterator
return $M->solve($B); return $M->solve($B);
} }
private function gaussElimination($b) : Matrix private function gaussElimination($b) : Matrix
{ {
$mDim = count($b); $mDim = count($b);
$matrix = $this->matrix; $matrix = $this->matrix;
@ -583,17 +583,17 @@ class Matrix implements \ArrayAccess, \Iterator
$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++) {
$temp = $matrix[$i][$col] / $matrix[$col][$col]; $temp = $matrix[$i][$col] / $matrix[$col][$col];

View File

@ -29,7 +29,7 @@ class QRDecomposition
$this->QR = $M->toArray(); $this->QR = $M->toArray();
$this->m = $M->getRowDimension(); $this->m = $M->getRowDimension();
$this->n = $M->getColumnDimension(); $this->n = $M->getColumnDimension();
// Main loop. // Main loop.
for ($k = 0; $k < $this->n; ++$k) { for ($k = 0; $k < $this->n; ++$k) {
// Compute 2-norm of k-th column without under/overflow. // Compute 2-norm of k-th column without under/overflow.
@ -37,17 +37,17 @@ class QRDecomposition
for ($i = $k; $i < $this->m; ++$i) { for ($i = $k; $i < $this->m; ++$i) {
$nrm = hypo($nrm, $this->QR[$i][$k]); $nrm = hypo($nrm, $this->QR[$i][$k]);
} }
if ($nrm != 0.0) { if ($nrm != 0.0) {
// Form k-th Householder vector. // Form k-th Householder vector.
if ($this->QR[$k][$k] < 0) { if ($this->QR[$k][$k] < 0) {
$nrm = -$nrm; $nrm = -$nrm;
} }
for ($i = $k; $i < $this->m; ++$i) { for ($i = $k; $i < $this->m; ++$i) {
$this->QR[$i][$k] /= $nrm; $this->QR[$i][$k] /= $nrm;
} }
$this->QR[$k][$k] += 1.0; $this->QR[$k][$k] += 1.0;
// Apply transformation to remaining columns. // Apply transformation to remaining columns.
for ($j = $k + 1; $j < $this->n; ++$j) { for ($j = $k + 1; $j < $this->n; ++$j) {
@ -55,14 +55,14 @@ class QRDecomposition
for ($i = $k; $i < $this->m; ++$i) { for ($i = $k; $i < $this->m; ++$i) {
$s += $this->QR[$i][$k] * $this->QR[$i][$j]; $s += $this->QR[$i][$k] * $this->QR[$i][$j];
} }
$s = -$s / $this->QR[$k][$k]; $s = -$s / $this->QR[$k][$k];
for ($i = $k; $i < $this->m; ++$i) { for ($i = $k; $i < $this->m; ++$i) {
$this->QR[$i][$j] += $s * $this->QR[$i][$k]; $this->QR[$i][$j] += $s * $this->QR[$i][$k];
} }
} }
} }
$this->Rdiag[$k] = -$nrm; $this->Rdiag[$k] = -$nrm;
} }
} }
@ -74,7 +74,7 @@ class QRDecomposition
return false; return false;
} }
} }
return true; return true;
} }
@ -91,7 +91,7 @@ class QRDecomposition
} }
} }
} }
$matrix = new Matrix(); $matrix = new Matrix();
$matrix->setArray($H); $matrix->setArray($H);
@ -113,7 +113,7 @@ class QRDecomposition
} }
} }
} }
$matrix = new Matrix(); $matrix = new Matrix();
$matrix->setArray($R); $matrix->setArray($R);
@ -128,7 +128,7 @@ class QRDecomposition
for ($i = 0; $i < $this->m; ++$i) { for ($i = 0; $i < $this->m; ++$i) {
$Q[$i][$k] = 0.0; $Q[$i][$k] = 0.0;
} }
$Q[$k][$k] = 1.0; $Q[$k][$k] = 1.0;
for ($j = $k; $j < $this->n; ++$j) { for ($j = $k; $j < $this->n; ++$j) {
if ($this->QR[$k][$k] != 0) { if ($this->QR[$k][$k] != 0) {
@ -143,7 +143,7 @@ class QRDecomposition
} }
} }
} }
$matrix = new Matrix(); $matrix = new Matrix();
$matrix->setArray($Q); $matrix->setArray($Q);

View File

@ -23,19 +23,19 @@ namespace phpOMS\Math\Stochastic;
class NaiveBayesFilter class NaiveBayesFilter
{ {
private $dict = []; private $dict = [];
public function __construct() public function __construct()
{ {
} }
public function trainMatch($matched) /* : void */ public function trainMatch($matched) /* : void */
{ {
} }
public function trainMismatch($mismatch) /* : void */ public function trainMismatch($mismatch) /* : void */
{ {
} }
public function match($toMatch) : float public function match($toMatch) : float
{ {
$normalizedDict = $this->normalizeDictionary(); $normalizedDict = $this->normalizeDictionary();
@ -46,10 +46,10 @@ class NaiveBayesFilter
$n += log(1 - $normalizedDict[$element]['match'] / $normalizedDict[$element]['total']) - log($normalizedDict[$element]['match'] / $normalizedDict[$element]['total']); $n += log(1 - $normalizedDict[$element]['match'] / $normalizedDict[$element]['total']) - log($normalizedDict[$element]['match'] / $normalizedDict[$element]['total']);
} }
} }
return 1 / (1 + exp($n)); return 1 / (1 + exp($n));
} }
private function normalizeDictionary() : array private function normalizeDictionary() : array
{ {
return $this->dict; return $this->dict;

View File

@ -33,7 +33,7 @@ abstract class HeaderAbstract
* @since 1.0.0 * @since 1.0.0
*/ */
protected static $isLocked = false; protected static $isLocked = false;
/** /**
* Localization. * Localization.
* *
@ -41,7 +41,7 @@ abstract class HeaderAbstract
* @since 1.0.0 * @since 1.0.0
*/ */
protected $l11n = null; protected $l11n = null;
/** /**
* Account. * Account.
* *
@ -49,7 +49,7 @@ abstract class HeaderAbstract
* @since 1.0.0 * @since 1.0.0
*/ */
protected $account = 0; protected $account = 0;
/** /**
* Response status. * Response status.
* *
@ -67,7 +67,7 @@ abstract class HeaderAbstract
{ {
$this->l11n = new Localization(); $this->l11n = new Localization();
} }
/** /**
* Set header locked. * Set header locked.
* *
@ -78,7 +78,7 @@ abstract class HeaderAbstract
// todo: maybe pass session as member and make lock not static // todo: maybe pass session as member and make lock not static
self::$isLocked = true; self::$isLocked = true;
} }
/** /**
* Is header locked? * Is header locked?
* *
@ -107,7 +107,7 @@ abstract class HeaderAbstract
* Set localization * Set localization
* *
* @param Localization $l11n Localization * @param Localization $l11n Localization
* *
* @return void * @return void
* *
* @since 1.0.0 * @since 1.0.0
@ -133,7 +133,7 @@ abstract class HeaderAbstract
* Set account id * Set account id
* *
* @param int $account Account id * @param int $account Account id
* *
* @return void * @return void
* *
* @since 1.0.0 * @since 1.0.0
@ -142,12 +142,12 @@ abstract class HeaderAbstract
{ {
$this->account = $account; $this->account = $account;
} }
/** /**
* Set status code * Set status code
* *
* @param int $status Status code * @param int $status Status code
* *
* @return void * @return void
* *
* @since 1.0.0 * @since 1.0.0

View File

@ -89,7 +89,7 @@ class Header extends HeaderAbstract
return true; return true;
} }
/** /**
* Is security header. * Is security header.
* *
@ -129,7 +129,7 @@ class Header extends HeaderAbstract
if ($this->status === 0) { if ($this->status === 0) {
$this->status = (int) \http_response_code(); $this->status = (int) \http_response_code();
} }
return parent::getStatusCode(); return parent::getStatusCode();
} }
@ -146,12 +146,12 @@ class Header extends HeaderAbstract
return getallheaders(); return getallheaders();
} }
$headers = []; $headers = [];
foreach ($_SERVER as $name => $value) { foreach ($_SERVER as $name => $value) {
if (substr($name, 0, 5) == 'HTTP_') { if (substr($name, 0, 5) == 'HTTP_') {
$headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value; $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
} }
} }
return $headers; return $headers;
} }

View File

@ -226,7 +226,7 @@ class Request extends RequestAbstract
{ {
$this->hash = []; $this->hash = [];
$pathArray = $this->uri->getPathElements(); $pathArray = $this->uri->getPathElements();
foreach ($pathArray as $key => $path) { foreach ($pathArray as $key => $path) {
$paths = []; $paths = [];
for ($i = $start; $i < $key + 1; $i++) { for ($i = $start; $i < $key + 1; $i++) {
@ -285,7 +285,7 @@ class Request extends RequestAbstract
foreach ($arr as $key => $val) { foreach ($arr as $key => $val) {
if (stripos($httpUserAgent, $val)) { if (stripos($httpUserAgent, $val)) {
$this->browser = $val; $this->browser = $val;
return $this->browser; return $this->browser;
} }
} }
@ -320,11 +320,11 @@ class Request extends RequestAbstract
if (!isset($this->os)) { if (!isset($this->os)) {
$arr = OSType::getConstants(); $arr = OSType::getConstants();
$httpUserAgent = strtolower($_SERVER['HTTP_USER_AGENT']); $httpUserAgent = strtolower($_SERVER['HTTP_USER_AGENT']);
foreach ($arr as $key => $val) { foreach ($arr as $key => $val) {
if (stripos($httpUserAgent, $val)) { if (stripos($httpUserAgent, $val)) {
$this->os = $val; $this->os = $val;
return $this->os; return $this->os;
} }
} }

View File

@ -140,7 +140,7 @@ class Response extends ResponseAbstract implements RenderableInterface
} }
$types = $this->header->get('Content-Type'); $types = $this->header->get('Content-Type');
if (stripos($types[0], MimeType::M_HTML) !== false) { if (stripos($types[0], MimeType::M_HTML) !== false) {
return trim(preg_replace('/(\s{2,}|\n|\t)(?![^<>]*<\/pre>)/', ' ', $render)); return trim(preg_replace('/(\s{2,}|\n|\t)(?![^<>]*<\/pre>)/', ' ', $render));
} }

View File

@ -136,7 +136,7 @@ class EmailAbstract
* *
* @param string $user Username * @param string $user Username
* @param string $pass Password * @param string $pass Password
* *
* @return void * @return void
* *
* @since 1.0.0 * @since 1.0.0
@ -408,7 +408,7 @@ class EmailAbstract
/** /**
* Create mailbox * Create mailbox
* *
* @param string $mailbox Mailbox to create * @param string $mailbox Mailbox to create
* *
* @return bool * @return bool
@ -422,7 +422,7 @@ class EmailAbstract
/** /**
* Rename mailbox * Rename mailbox
* *
* @param string $old Old mailbox name * @param string $old Old mailbox name
* @param string $new New mailbox name * @param string $new New mailbox name
* *
@ -437,7 +437,7 @@ class EmailAbstract
/** /**
* Delete mailbox * Delete mailbox
* *
* @param string $mailbox Mailbox to delete * @param string $mailbox Mailbox to delete
* *
* @return bool * @return bool
@ -451,7 +451,7 @@ class EmailAbstract
/** /**
* Check message to delete * Check message to delete
* *
* @param int $id Message id * @param int $id Message id
* *
* @return bool * @return bool
@ -465,7 +465,7 @@ class EmailAbstract
/** /**
* Delete all marked messages * Delete all marked messages
* *
* @return bool * @return bool
* *
* @since 1.0.0 * @since 1.0.0
@ -477,7 +477,7 @@ class EmailAbstract
/** /**
* Check message to delete * Check message to delete
* *
* @param int $length Amount of message overview * @param int $length Amount of message overview
* @param int $start Start index of the overview for pagination * @param int $start Start index of the overview for pagination
* *
@ -497,7 +497,7 @@ class EmailAbstract
/** /**
* Count messages * Count messages
* *
* @return int * @return int
* *
* @since 1.0.0 * @since 1.0.0
@ -509,7 +509,7 @@ class EmailAbstract
/** /**
* Get message header * Get message header
* *
* @param int $id Message id * @param int $id Message id
* *
* @return string * @return string

View File

@ -44,7 +44,7 @@ class Imap extends EmailAbstract
* *
* @param string $user Username * @param string $user Username
* @param string $pass Password * @param string $pass Password
* *
* @return void * @return void
* *
* @since 1.0.0 * @since 1.0.0

View File

@ -44,7 +44,7 @@ class Nntp extends EmailAbstract
* *
* @param string $user Username * @param string $user Username
* @param string $pass Password * @param string $pass Password
* *
* @return void * @return void
* *
* @since 1.0.0 * @since 1.0.0

View File

@ -44,7 +44,7 @@ class Pop3 extends EmailAbstract
* *
* @param string $user Username * @param string $user Username
* @param string $pass Password * @param string $pass Password
* *
* @return void * @return void
* *
* @since 1.0.0 * @since 1.0.0

View File

@ -201,7 +201,7 @@ abstract class RequestAbstract implements MessageInterface
* Get data. * Get data.
* *
* @param mixed $key Data key * @param mixed $key Data key
* *
* @return mixed * @return mixed
* *
* @since 1.0.0 * @since 1.0.0
@ -221,7 +221,7 @@ abstract class RequestAbstract implements MessageInterface
* Check if has data. * Check if has data.
* *
* @param mixed $key Data key * @param mixed $key Data key
* *
* @return bool * @return bool
* *
* @since 1.0.0 * @since 1.0.0

View File

@ -147,7 +147,7 @@ class ModuleManager
$i = 1; $i = 1;
$c = count($uriHash); $c = count($uriHash);
for ($k = 0; $k < $c; $k++) { for ($k = 0; $k < $c; $k++) {
$uriPdo .= ':pid' . $i . ','; $uriPdo .= ':pid' . $i . ',';
$i++; $i++;
@ -182,7 +182,7 @@ class ModuleManager
/** /**
* Get all installed modules that are active (not just on this uri). * Get all installed modules that are active (not just on this uri).
* *
* @param bool $useCache Use Cache or load new * @param bool $useCache Use Cache or load new
* *
* @return array * @return array
@ -253,7 +253,7 @@ class ModuleManager
/** /**
* Get all installed modules. * Get all installed modules.
* *
* @param bool $useCache Use Cache * @param bool $useCache Use Cache
* *
* @return array * @return array

View File

@ -23,7 +23,7 @@ use phpOMS\Utils\StringUtils;
/** /**
* Package Manager model. * Package Manager model.
* *
* The package manager is responsible for handling installation and update packages for modules, frameworks and resources. * The package manager is responsible for handling installation and update packages for modules, frameworks and resources.
* *
* @package Framework * @package Framework
@ -67,13 +67,13 @@ class PackageManager
/** /**
* Constructor. * Constructor.
* *
* @param string $path Package source path e.g. path after download. * @param string $path Package source path e.g. path after download.
* @param string $basePath Path of the application * @param string $basePath Path of the application
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public function __construct(string $path, string $basePath) public function __construct(string $path, string $basePath)
{ {
$this->path = $path; $this->path = $path;
$this->basePath = $basePath; $this->basePath = $basePath;
@ -81,11 +81,11 @@ class PackageManager
/** /**
* Extract package to temporary destination * Extract package to temporary destination
* *
* @param string $path Temporary extract path * @param string $path Temporary extract path
* *
* @return void * @return void
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public function extract(string $path) /* : void */ public function extract(string $path) /* : void */
@ -114,7 +114,7 @@ class PackageManager
/** /**
* Validate package integrity * Validate package integrity
* *
* @return bool Returns true if the package is authentic, false otherwise * @return bool Returns true if the package is authentic, false otherwise
* *
* @since 1.0.0 * @since 1.0.0
@ -126,7 +126,7 @@ class PackageManager
/** /**
* Hash array of files * Hash array of files
* *
* @return string Hash value of files * @return string Hash value of files
* *
* @since 1.0.0 * @since 1.0.0
@ -138,7 +138,7 @@ class PackageManager
foreach ($files as $file) { foreach ($files as $file) {
if ($file === 'package.cert') { if ($file === 'package.cert') {
continue; continue;
} }
\sodium_crypto_generichash_update($state, file_get_contents($this->extractPath . '/package/' . $file)); \sodium_crypto_generichash_update($state, file_get_contents($this->extractPath . '/package/' . $file));
@ -149,7 +149,7 @@ class PackageManager
/** /**
* Install package * Install package
* *
* @return void * @return void
* *
* @throws \Exception * @throws \Exception
@ -173,7 +173,7 @@ class PackageManager
* Move files * Move files
* *
* @param mixed $components Component data * @param mixed $components Component data
* *
* @return void * @return void
* *
* @since 1.0.0 * @since 1.0.0
@ -189,7 +189,7 @@ class PackageManager
* Copy files * Copy files
* *
* @param mixed $components Component data * @param mixed $components Component data
* *
* @return void * @return void
* *
* @since 1.0.0 * @since 1.0.0
@ -209,7 +209,7 @@ class PackageManager
* Delete files * Delete files
* *
* @param mixed $components Component data * @param mixed $components Component data
* *
* @return void * @return void
* *
* @since 1.0.0 * @since 1.0.0
@ -225,12 +225,12 @@ class PackageManager
* Execute commands * Execute commands
* *
* @param mixed $components Component data * @param mixed $components Component data
* *
* @return void * @return void
* *
* @since 1.0.0 * @since 1.0.0
*/ */
private function execute($components) private function execute($components)
{ {
foreach ($components as $component) { foreach ($components as $component) {
include $this->basePath . '/' . $component; include $this->basePath . '/' . $component;
@ -239,12 +239,12 @@ class PackageManager
/** /**
* Cleanup after installation * Cleanup after installation
* *
* @return void * @return void
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public function cleanup() public function cleanup()
{ {
File::delete($this->path); File::delete($this->path);
Directory::delete($this->extractPath); Directory::delete($this->extractPath);
@ -255,7 +255,7 @@ class PackageManager
* *
* @param string $signedHash Hash to authenticate * @param string $signedHash Hash to authenticate
* @param string $rawHash Hash to compare against * @param string $rawHash Hash to compare against
* *
* @return bool * @return bool
* *
* @since 1.0.0 * @since 1.0.0

View File

@ -25,12 +25,12 @@ namespace phpOMS\Security;
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
@ -43,7 +43,7 @@ class PhpCode
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);

View File

@ -51,7 +51,7 @@ class SmartDateTime extends \DateTime
{ {
parent::__construct($time, $timezone); parent::__construct($time, $timezone);
} }
/** /**
* Create object from DateTime * Create object from DateTime
* *
@ -230,7 +230,7 @@ class SmartDateTime extends \DateTime
{ {
return (int) date('w', strtotime($d . '-' . $m . '-' . $y)); return (int) date('w', strtotime($d . '-' . $m . '-' . $y));
} }
/** /**
* Get day of week * Get day of week
* *
@ -255,10 +255,10 @@ class SmartDateTime extends \DateTime
public function getMonthCalendar(int $weekStartsWith = 0) : array public function getMonthCalendar(int $weekStartsWith = 0) : array
{ {
$days = []; $days = [];
// get day of first day in month // get day of first day in month
$firstDay = $this->getFirstDayOfMonth(); $firstDay = $this->getFirstDayOfMonth();
// calculate difference to $weekStartsWith // calculate difference to $weekStartsWith
$diffToWeekStart = Functions::mod($firstDay - $weekStartsWith, 7); $diffToWeekStart = Functions::mod($firstDay - $weekStartsWith, 7);
$diffToWeekStart = $diffToWeekStart === 0 ? 7 : $diffToWeekStart; $diffToWeekStart = $diffToWeekStart === 0 ? 7 : $diffToWeekStart;
@ -266,18 +266,18 @@ class SmartDateTime extends \DateTime
// 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)
for ($i = $daysPreviousMonth - $diffToWeekStart; $i < $daysPreviousMonth; $i++) { for ($i = $daysPreviousMonth - $diffToWeekStart; $i < $daysPreviousMonth; $i++) {
$days[] = new \DateTime($previousMonth->format('Y') . '-' . $previousMonth->format('m') . '-' . ($i + 1)); $days[] = new \DateTime($previousMonth->format('Y') . '-' . $previousMonth->format('m') . '-' . ($i + 1));
} }
// add normal count of current days // add normal count of current days
$daysMonth = $this->getDaysOfMonth(); $daysMonth = $this->getDaysOfMonth();
for ($i = 1; $i <= $daysMonth; $i++) { for ($i = 1; $i <= $daysMonth; $i++) {
$days[] = new \DateTime($this->format('Y') . '-' . $this->format('m') . '-' . ($i)); $days[] = new \DateTime($this->format('Y') . '-' . $this->format('m') . '-' . ($i));
} }
// 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);

View File

@ -36,7 +36,7 @@ class BinaryTree extends Tree
$list->setLeft($list->invert($list->nodes[1])); $list->setLeft($list->invert($list->nodes[1]));
$list->setRight($list->invert($left)); $list->setRight($list->invert($left));
return $list; return $list;
} }
/** /**
@ -125,7 +125,7 @@ class BinaryTree extends Tree
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public function inOrder(Node $node, \Closure $callback) public function inOrder(Node $node, \Closure $callback)
{ {
$this->inOrder($this->getLeft($node), $callback); $this->inOrder($this->getLeft($node), $callback);
$callback($node); $callback($node);
@ -141,7 +141,7 @@ class BinaryTree extends Tree
* *
* @since 1.0.0 * @since 1.0.0
*/ */
private function getVerticalOrder(Node $node, int $horizontalDistance = 0, array &$order) private function getVerticalOrder(Node $node, int $horizontalDistance = 0, array &$order)
{ {
if (!isset($order[$horizontalDistance])) { if (!isset($order[$horizontalDistance])) {
$order[$horizontalDistance] = []; $order[$horizontalDistance] = [];
@ -190,7 +190,7 @@ class BinaryTree extends Tree
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public function isSymmetric(Node $node1 = null, Node $node2 = null) : bool public function isSymmetric(Node $node1 = null, Node $node2 = null) : bool
{ {
if (!isset($node1) && !isset($node2)) { if (!isset($node1) && !isset($node2)) {
return true; return true;

View File

@ -30,14 +30,14 @@ class Edge
private $directed = false; private $directed = false;
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;
} }
public function getNodes() : array public function getNodes() : array
{ {
return [$this->node1, $this->node2]; return [$this->node1, $this->node2];
} }

View File

@ -70,7 +70,7 @@ class Tree extends Graph
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public function getMaxDepth(Node $node = null) : int public function getMaxDepth(Node $node = null) : int
{ {
$currentNode = $node ?? $this->root; $currentNode = $node ?? $this->root;
@ -146,7 +146,7 @@ class Tree extends Graph
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public function isLeaf(Node $node) : bool public function isLeaf(Node $node) : bool
{ {
return count($this->getEdgesOfNode($node)) === 1; return count($this->getEdgesOfNode($node)) === 1;
} }
@ -187,7 +187,7 @@ class Tree extends Graph
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public function isFull(int $type) : bool public function isFull(int $type) : bool
{ {
if (count($this->edges) % $type !== 0) { if (count($this->edges) % $type !== 0) {
return false; return false;
@ -225,7 +225,7 @@ class Tree extends Graph
$this->preOrder($neighbor, $callback); $this->preOrder($neighbor, $callback);
} }
} }
/** /**
* Perform action on tree in post-order. * Perform action on tree in post-order.
* *
@ -238,7 +238,7 @@ class Tree extends Graph
if (count($this->nodes) === 0) { if (count($this->nodes) === 0) {
return; return;
} }
$neighbors = $this->getNeighbors($node); $neighbors = $this->getNeighbors($node);
foreach ($neighbors as $neighbor) { foreach ($neighbors as $neighbor) {

View File

@ -31,7 +31,7 @@ interface ContainerInterface
* *
* @param string $path Path of the resource * @param string $path Path of the resource
* *
* @return \DateTime * @return \DateTime
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -42,7 +42,7 @@ interface ContainerInterface
* *
* @param string $path Path of the resource * @param string $path Path of the resource
* *
* @return \DateTime * @return \DateTime
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -53,7 +53,7 @@ interface ContainerInterface
* *
* @param string $path Path of the resource * @param string $path Path of the resource
* *
* @return int * @return int
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -77,7 +77,7 @@ interface ContainerInterface
* *
* @param string $path Path of the resource * @param string $path Path of the resource
* *
* @return string * @return string
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -191,7 +191,7 @@ interface ContainerInterface
/** /**
* Get amount of sub-resources. * Get amount of sub-resources.
* *
* A file will always return 1 as it doesn't have any sub-resources. * A file will always return 1 as it doesn't have any sub-resources.
* *
* @param bool $recursive Should count also sub-sub-resources * @param bool $recursive Should count also sub-sub-resources
* *
@ -235,7 +235,7 @@ interface ContainerInterface
* *
* The parent resource path is always a directory. * The parent resource path is always a directory.
* *
* @return ContainerInterface * @return ContainerInterface
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -286,7 +286,7 @@ interface ContainerInterface
/** /**
* Get the datetime when the resource got created. * Get the datetime when the resource got created.
* *
* @return \DateTime * @return \DateTime
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -295,7 +295,7 @@ interface ContainerInterface
/** /**
* Get the datetime when the resource got last modified. * Get the datetime when the resource got last modified.
* *
* @return \DateTime * @return \DateTime
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -304,7 +304,7 @@ interface ContainerInterface
/** /**
* Get the owner id of the resource. * Get the owner id of the resource.
* *
* @return int * @return int
* *
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -34,7 +34,7 @@ interface FileInterface extends ContainerInterface
* @param string $content Content to save in file * @param string $content Content to save in file
* @param int $mode Mode (overwrite, append) * @param int $mode Mode (overwrite, append)
* *
* @return bool * @return bool
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -110,7 +110,7 @@ interface FileInterface extends ContainerInterface
* @param string $content Content to save in file * @param string $content Content to save in file
* @param int $mode Mode (overwrite, append) * @param int $mode Mode (overwrite, append)
* *
* @return bool * @return bool
* *
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -40,7 +40,7 @@ class FileUtils
* @since 1.0.0 * @since 1.0.0
* @codeCoverageIgnore * @codeCoverageIgnore
*/ */
private function __construct() private function __construct()
{ {
} }
@ -102,7 +102,7 @@ class FileUtils
if (empty($part) || $part === '.') { if (empty($part) || $part === '.') {
continue; continue;
} }
if ($part !== '..') { if ($part !== '..') {
$path[] = $part; $path[] = $part;
} elseif (!empty($path)) { } elseif (!empty($path)) {
@ -111,7 +111,7 @@ class FileUtils
throw new PathException($origPath); throw new PathException($origPath);
} }
} }
return $startsWithSlash . implode('/', $path); return $startsWithSlash . implode('/', $path);
} }

View File

@ -213,7 +213,7 @@ class File extends FileAbstract implements FileInterface
$changed->setTimestamp(ftp_mdtm($con, $http->getPath())); $changed->setTimestamp(ftp_mdtm($con, $http->getPath()));
fclose($con); fclose($con);
return $changed; return $changed;
} }
@ -269,7 +269,7 @@ class File extends FileAbstract implements FileInterface
$items = []; $items = [];
if (is_array($files = ftp_rawlist($con, LocalFile::dirpath($path)))) { if (is_array($files = ftp_rawlist($con, LocalFile::dirpath($path)))) {
foreach ($files as $fileData) { foreach ($files as $fileData) {
if (strpos($fileData, self::name($path)) !== false) { if (strpos($fileData, self::name($path)) !== false) {
$chunks = preg_split("/\s+/", $fileData); $chunks = preg_split("/\s+/", $fileData);
@ -281,17 +281,17 @@ class File extends FileAbstract implements FileInterface
break; break;
} }
} }
} }
return $items; return $items;
} }
/** /**
* 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
@ -303,9 +303,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
@ -324,7 +324,7 @@ class File extends FileAbstract implements FileInterface
if (($src = self::get($from)) === false) { if (($src = self::get($from)) === false) {
return false; return false;
} }
return self::put($to, $src, $overwrite ? ContentPutMode::REPLACE : ContentPutMode::CREATE); return self::put($to, $src, $overwrite ? ContentPutMode::REPLACE : ContentPutMode::CREATE);
} }

View File

@ -237,9 +237,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
@ -251,9 +251,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
@ -319,7 +319,7 @@ class File extends FileAbstract implements FileInterface
/** /**
* 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
@ -331,7 +331,7 @@ class File extends FileAbstract implements FileInterface
/** /**
* 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
@ -362,7 +362,7 @@ class File extends FileAbstract implements FileInterface
if (!is_writable(dirname($path))) { if (!is_writable(dirname($path))) {
return false; return false;
} }
touch($path); touch($path);
return true; return true;

View File

@ -33,7 +33,7 @@ final class Storage
* @since 1.0.0 * @since 1.0.0
*/ */
private static $registered = []; private static $registered = [];
/** /**
* Constructor. * Constructor.
* *
@ -42,7 +42,7 @@ final class Storage
*/ */
private function __construct() private function __construct()
{ {
} }
/** /**

View File

@ -39,7 +39,7 @@ final class OperatingSystem
return SystemType::WIN; return SystemType::WIN;
} elseif (stristr(PHP_OS, 'LINUX') !== false) { } elseif (stristr(PHP_OS, 'LINUX') !== false) {
return SystemType::LINUX; return SystemType::LINUX;
} }
return SystemType::UNKNOWN; return SystemType::UNKNOWN;
} }

View File

@ -49,7 +49,7 @@ class SystemUtils
if (stristr(PHP_OS, 'WIN')) { if (stristr(PHP_OS, 'WIN')) {
$mem = null; $mem = null;
exec('wmic memorychip get capacity', $mem); exec('wmic memorychip get capacity', $mem);
/** @var array $mem */ /** @var array $mem */
$mem = array_sum($mem) / 1024; $mem = array_sum($mem) / 1024;
} elseif (stristr(PHP_OS, 'LINUX')) { } elseif (stristr(PHP_OS, 'LINUX')) {
@ -63,7 +63,7 @@ class SystemUtils
break; break;
} }
} }
fclose($fh); fclose($fh);
} }

View File

@ -87,7 +87,7 @@ final class UnhandledHandler
/** /**
* Shutdown handler. * Shutdown handler.
* *
* @return void * @return void
* *
* @since 1.0.0 * @since 1.0.0

View File

@ -156,7 +156,7 @@ class Http implements UriInterface
$this->path = substr($this->path, 0, -4); $this->path = substr($this->path, 0, -4);
} }
$this->path = strpos($this->path, $this->rootPath) === 0 ? substr($this->path, strlen($this->rootPath), strlen($this->path)) : $this->path; $this->path = strpos($this->path, $this->rootPath) === 0 ? substr($this->path, strlen($this->rootPath), strlen($this->path)) : $this->path;
$this->queryString = $url['query'] ?? ''; $this->queryString = $url['query'] ?? '';
if (!empty($this->queryString)) { if (!empty($this->queryString)) {
@ -246,7 +246,7 @@ class Http implements UriInterface
{ {
return $this->path; return $this->path;
} }
/** /**
* Get path offset. * Get path offset.
* *
@ -295,7 +295,7 @@ class Http implements UriInterface
*/ */
public function getPathElements() : array public function getPathElements() : array
{ {
return explode('/', $this->path); return explode('/', $this->path);
} }
/** /**

View File

@ -88,7 +88,7 @@ class UriFactory
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public static function clearAll() : bool public static function clearAll() : bool
{ {
self::$uri = []; self::$uri = [];
@ -132,7 +132,7 @@ class UriFactory
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public static function clear(string $key) : bool public static function clear(string $key) : bool
{ {
if (isset(self::$uri[$key])) { if (isset(self::$uri[$key])) {
unset(self::$uri[$key]); unset(self::$uri[$key]);
@ -152,7 +152,7 @@ class UriFactory
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public static function clearLike(string $pattern) : bool public static function clearLike(string $pattern) : bool
{ {
$success = false; $success = false;

View File

@ -229,7 +229,7 @@ abstract class C128Abstract
* Save to file * Save to file
* *
* @param string $file File path/name * @param string $file File path/name
* *
* @return void * @return void
* *
* @since 1.0.0 * @since 1.0.0
@ -246,7 +246,7 @@ abstract class C128Abstract
* Save to file * Save to file
* *
* @param string $file File path/name * @param string $file File path/name
* *
* @return void * @return void
* *
* @since 1.0.0 * @since 1.0.0

View File

@ -102,12 +102,12 @@ class Currency
if (!isset($xml->Cube)) { if (!isset($xml->Cube)) {
throw new \Exception('Invalid xml path'); throw new \Exception('Invalid xml path');
} }
$node = $xml->Cube->Cube->Cube; $node = $xml->Cube->Cube->Cube;
self::$ecbCurrencies = []; self::$ecbCurrencies = [];
foreach ($node as $key => $value) { foreach ($node as $key => $value) {
self::$ecbCurrencies[strtoupper((string) $value->attributes()['currency'])] = (float) $value->attributes()['rate']; self::$ecbCurrencies[strtoupper((string) $value->attributes()['currency'])] = (float) $value->attributes()['rate'];
} }

View File

@ -214,7 +214,7 @@ class Repository
* Create repository * Create repository
* *
* @param string $source Create repository from source (optional, can be remote) * @param string $source Create repository from source (optional, can be remote)
* *
* @return string * @return string
* *
* @throws \Exception * @throws \Exception
@ -292,7 +292,7 @@ class Repository
* *
* @since 1.0.0 * @since 1.0.0
*/ */
private function parseFileList($files) : string private function parseFileList($files) : string
{ {
if (is_array($files)) { if (is_array($files)) {
return '"' . implode('" "', $files) . '"'; return '"' . implode('" "', $files) . '"';

View File

@ -34,7 +34,7 @@ interface ArchiveInterface
* @since 1.0.0 * @since 1.0.0
*/ */
public static function pack($sources, string $destination, bool $overwrite = true) : bool; public static function pack($sources, string $destination, bool $overwrite = true) : bool;
/** /**
* Unpack archive. * Unpack archive.
* *

View File

@ -33,21 +33,21 @@ class Gz implements ArchiveInterface
if (!$overwrite && file_exists($destination)) { if (!$overwrite && file_exists($destination)) {
return false; return false;
} }
if (($gz = gzopen($destination, 'w')) === false) { if (($gz = gzopen($destination, 'w')) === false) {
return false; return false;
} }
$src = fopen($source, 'r'); $src = fopen($source, 'r');
while (!feof($src)) { while (!feof($src)) {
gzwrite($gz, fread($src, 4096)); gzwrite($gz, fread($src, 4096));
} }
fclose($src); fclose($src);
return gzclose($gz); return gzclose($gz);
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
@ -57,18 +57,18 @@ class Gz implements ArchiveInterface
if (file_exists($destination)) { if (file_exists($destination)) {
return false; return false;
} }
if (($gz = gzopen($source, 'w')) === false) { if (($gz = gzopen($source, 'w')) === false) {
return false; return false;
} }
$dest = fopen($destination, 'w'); $dest = fopen($destination, 'w');
while (!gzeof($gz)) { while (!gzeof($gz)) {
fwrite($dest, gzread($gz, 4096)); fwrite($dest, gzread($gz, 4096));
} }
fclose($dest); fclose($dest);
return gzclose($gz); return gzclose($gz);
} }
} }

View File

@ -75,6 +75,6 @@ class Tar implements ArchiveInterface
*/ */
public static function unpack(string $source, string $destination) : bool public static function unpack(string $source, string $destination) : bool
{ {
} }
} }

View File

@ -38,7 +38,7 @@ class TarGz implements ArchiveInterface
return $pack; return $pack;
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */

View File

@ -81,7 +81,7 @@ class Zip implements ArchiveInterface
return $zip->close(); return $zip->close();
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
@ -98,9 +98,9 @@ class Zip implements ArchiveInterface
if (!$zip->open($source)) { if (!$zip->open($source)) {
return false; return false;
} }
$zip->extractTo($destination . '/'); $zip->extractTo($destination . '/');
return $zip->close(); return $zip->close();
} }
} }

View File

@ -113,11 +113,11 @@ class Markdown
]; ];
protected static $safeLinksWhitelist = [ protected static $safeLinksWhitelist = [
'http://', 'https://', 'ftp://', 'ftps://', 'mailto:', 'http://', 'https://', 'ftp://', 'ftps://', 'mailto:',
'data:image/png;base64,', 'data:image/gif;base64,', 'data:image/jpeg;base64,', 'data:image/png;base64,', 'data:image/gif;base64,', 'data:image/jpeg;base64,',
'irc:', 'ircs:', 'git:', 'ssh:', 'news:', 'steam:', 'irc:', 'ircs:', 'git:', 'ssh:', 'news:', 'steam:',
]; ];
private static $definitionData = []; private static $definitionData = [];
public static function parse(string $text) : string public static function parse(string $text) : string
@ -366,7 +366,7 @@ class Markdown
} }
$text = trim($lineArray['text'], '# '); $text = trim($lineArray['text'], '# ');
return [ return [
'element' => [ 'element' => [
'name' => 'h' . min(6, $level), 'name' => 'h' . min(6, $level),
@ -534,7 +534,7 @@ class Markdown
]; ];
self::$definitionData['Reference'][$id] = $data; self::$definitionData['Reference'][$id] = $data;
return ['hidden' => true]; return ['hidden' => true];
} }
@ -744,7 +744,7 @@ class Markdown
if (strpos($excerpt['text'], '>') === false || !preg_match('/^<((mailto:)?\S+?@\S+?)>/i', $excerpt['text'], $matches)) { if (strpos($excerpt['text'], '>') === false || !preg_match('/^<((mailto:)?\S+?@\S+?)>/i', $excerpt['text'], $matches)) {
return; return;
} }
$url = $matches[1]; $url = $matches[1];
if (!isset($matches[2])) { if (!isset($matches[2])) {
@ -1066,7 +1066,7 @@ class Markdown
return $element; return $element;
} }
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

@ -47,7 +47,7 @@ class Permutation
$newres[] = $val; $newres[] = $val;
unset($newArr[$key]); unset($newArr[$key]);
$permutations = array_merge($permutations, self::permut($newArr, $newres)); $permutations = array_merge($permutations, self::permut($newArr, $newres));
} }
} }

View File

@ -38,7 +38,7 @@ class DateTime
public static function generateDateTime(\DateTime $start, \DateTime $end) : \DateTime public static function generateDateTime(\DateTime $start, \DateTime $end) : \DateTime
{ {
$rng = new \DateTime(); $rng = new \DateTime();
return $rng->setTimestamp(mt_rand($start->getTimestamp(), $end->getTimestamp())); return $rng->setTimestamp(mt_rand($start->getTimestamp(), $end->getTimestamp()));
} }
} }

View File

@ -32,16 +32,16 @@ class File
* @since 1.0.0 * @since 1.0.0
*/ */
private static $extensions = [ private static $extensions = [
['exe', null], ['dat', null], ['txt', null], ['csv', 'txt'], ['doc', null], ['docx', 'doc'], ['exe', null], ['dat', null], ['txt', null], ['csv', 'txt'], ['doc', null], ['docx', 'doc'],
['mp3', null], ['mp4', null], ['avi', null], ['mpeg', null], ['wmv', null], ['ppt', null], ['mp3', null], ['mp4', null], ['avi', null], ['mpeg', null], ['wmv', null], ['ppt', null],
['xls', null], ['xlsx', 'xls'], ['xlsxm', 'xls'], ['php', null], ['html', null], ['tex', null], ['xls', null], ['xlsx', 'xls'], ['xlsxm', 'xls'], ['php', null], ['html', null], ['tex', null],
['js', null], ['c', null], ['cpp', null], ['h', null], ['res', null], ['ico', null], ['js', null], ['c', null], ['cpp', null], ['h', null], ['res', null], ['ico', null],
['jpg', null], ['png', null], ['gif', null], ['bmp', null], ['ttf', null], ['zip', null], ['jpg', null], ['png', null], ['gif', null], ['bmp', null], ['ttf', null], ['zip', null],
['rar', null], ['7z', null], ['tar', 'gz'], ['gz', null], ['gz', null], ['sh', null], ['rar', null], ['7z', null], ['tar', 'gz'], ['gz', null], ['gz', null], ['sh', null],
['bat', null], ['iso', null], ['css', null], ['json', null], ['ini', null], ['psd', null], ['bat', null], ['iso', null], ['css', null], ['json', null], ['ini', null], ['psd', null],
['pptx', 'ppt'], ['xml', null], ['dll', null], ['wav', null], ['wma', null], ['vb', null], ['pptx', 'ppt'], ['xml', null], ['dll', null], ['wav', null], ['wma', null], ['vb', null],
['tmp', null], ['tif', null], ['sql', null], ['swf', null], ['svg', null], ['rpm', null], ['tmp', null], ['tif', null], ['sql', null], ['swf', null], ['svg', null], ['rpm', null],
['rss', null], ['pkg', null], ['pdf', null], ['mpg', null], ['mov', null], ['jar', null], ['rss', null], ['pkg', null], ['pdf', null], ['mpg', null], ['mov', null], ['jar', null],
['flv', null], ['fla', null], ['deb', null], ['py', null], ['pl', null], ['flv', null], ['fla', null], ['deb', null], ['py', null], ['pl', null],
]; ];

View File

@ -470,11 +470,11 @@ class Name
'male' => ['none'], 'male' => ['none'],
'family' => [ 'family' => [
'Հովհաննիսյան', 'Հարությունյան', 'Սարգսյան', 'Խաչատրյան', 'Գրիգորյան', 'Հովհաննիսյան', 'Հարությունյան', 'Սարգսյան', 'Խաչատրյան', 'Գրիգորյան',
'আহমেদ', 'আলী', 'আক্তার', 'বন্দ্যোপাধ্যায়', 'নিক', 'ব্যাপারী', 'বড়ুয়া', 'বিশ্বাস', 'ভৌমিক', 'বসু', 'আহমেদ', 'আলী', 'আক্তার', 'বন্দ্যোপাধ্যায়', 'নিক', 'ব্যাপারী', 'বড়ুয়া', 'বিশ্বাস', 'ভৌমিক', 'বসু',
'王', '李', '张', '刘', '陈', '杨', '黄', '赵', '吴', '周', '徐', '孙', '马', '朱', '胡', '郭', '何', '高', '林', '罗', '王', '李', '张', '刘', '陈', '杨', '黄', '赵', '吴', '周', '徐', '孙', '马', '朱', '胡', '郭', '何', '高', '林', '罗',
'כהן', 'לוי', 'מזרחי', 'פרץ', 'ביטון', 'דהן', 'אברהם', 'פרידמן', 'מלכה', 'אזולאי', 'כץ', 'יוסף', 'דוד', 'עמר', 'אוחיון', 'כהן', 'לוי', 'מזרחי', 'פרץ', 'ביטון', 'דהן', 'אברהם', 'פרידמן', 'מלכה', 'אזולאי', 'כץ', 'יוסף', 'דוד', 'עמר', 'אוחיון',
'김', '리', '박', '최', '정', '강', '조', '윤', '장', '림', '한', '신', '서', '권', '황', '안', '송', '홍', '고', '문', '손', '량', '김', '리', '박', '최', '정', '강', '조', '윤', '장', '림', '한', '신', '서', '권', '황', '안', '송', '홍', '고', '문', '손', '량',
'Yılmaz', 'Kaya', 'Demir', 'Şahin', 'Çelik', 'Yıldız', 'Yıldırım', 'Öztürk', 'Aydın', 'Özdemir', 'Arslan', 'Doğan', 'Kılıç', 'Aslan', 'Çetin', 'Kara', 'Koç', 'Kurt', 'Özkan', 'Şimşek', 'Yılmaz', 'Kaya', 'Demir', 'Şahin', 'Çelik', 'Yıldız', 'Yıldırım', 'Öztürk', 'Aydın', 'Özdemir', 'Arslan', 'Doğan', 'Kılıç', 'Aslan', 'Çetin', 'Kara', 'Koç', 'Kurt', 'Özkan', 'Şimşek',
], ],
] ]
]; ];

View File

@ -32,21 +32,21 @@ class Text
* @since 1.0.0 * @since 1.0.0
*/ */
private static $words_west = [ private static $words_west = [
'lorem', 'ipsum', 'dolor', 'sit', 'amet', 'consectetur', 'adipiscing', 'elit', 'curabitur', 'vel', 'hendrerit', 'libero', 'lorem', 'ipsum', 'dolor', 'sit', 'amet', 'consectetur', 'adipiscing', 'elit', 'curabitur', 'vel', 'hendrerit', 'libero',
'eleifend', 'blandit', 'nunc', 'ornare', 'odio', 'ut', 'orci', 'gravida', 'imperdiet', 'nullam', 'purus', 'lacinia', 'a', 'eleifend', 'blandit', 'nunc', 'ornare', 'odio', 'ut', 'orci', 'gravida', 'imperdiet', 'nullam', 'purus', 'lacinia', 'a',
'pretium', 'quis', 'congue', 'praesent', 'sagittis', 'laoreet', 'auctor', 'mauris', 'non', 'velit', 'eros', 'dictum', 'pretium', 'quis', 'congue', 'praesent', 'sagittis', 'laoreet', 'auctor', 'mauris', 'non', 'velit', 'eros', 'dictum',
'proin', 'accumsan', 'sapien', 'nec', 'massa', 'volutpat', 'venenatis', 'sed', 'eu', 'molestie', 'lacus', 'quisque', 'proin', 'accumsan', 'sapien', 'nec', 'massa', 'volutpat', 'venenatis', 'sed', 'eu', 'molestie', 'lacus', 'quisque',
'porttitor', 'ligula', 'dui', 'mollis', 'tempus', 'at', 'magna', 'vestibulum', 'turpis', 'ac', 'diam', 'tincidunt', 'id', 'porttitor', 'ligula', 'dui', 'mollis', 'tempus', 'at', 'magna', 'vestibulum', 'turpis', 'ac', 'diam', 'tincidunt', 'id',
'condimentum', 'enim', 'sodales', 'in', 'hac', 'habitasse', 'platea', 'dictumst', 'aenean', 'neque', 'fusce', 'augue', 'condimentum', 'enim', 'sodales', 'in', 'hac', 'habitasse', 'platea', 'dictumst', 'aenean', 'neque', 'fusce', 'augue',
'leo', 'eget', 'semper', 'mattis', 'tortor', 'scelerisque', 'nulla', 'interdum', 'tellus', 'malesuada', 'rhoncus', 'porta', 'leo', 'eget', 'semper', 'mattis', 'tortor', 'scelerisque', 'nulla', 'interdum', 'tellus', 'malesuada', 'rhoncus', 'porta',
'sem', 'aliquet', 'et', 'nam', 'suspendisse', 'potenti', 'vivamus', 'luctus', 'fringilla', 'erat', 'donec', 'justo', 'sem', 'aliquet', 'et', 'nam', 'suspendisse', 'potenti', 'vivamus', 'luctus', 'fringilla', 'erat', 'donec', 'justo',
'vehicula', 'ultricies', 'varius', 'ante', 'primis', 'faucibus', 'ultrices', 'posuere', 'cubilia', 'curae', 'etiam', 'vehicula', 'ultricies', 'varius', 'ante', 'primis', 'faucibus', 'ultrices', 'posuere', 'cubilia', 'curae', 'etiam',
'cursus', 'aliquam', 'quam', 'dapibus', 'nisl', 'feugiat', 'egestas', 'class', 'aptent', 'taciti', 'sociosqu', 'ad', 'cursus', 'aliquam', 'quam', 'dapibus', 'nisl', 'feugiat', 'egestas', 'class', 'aptent', 'taciti', 'sociosqu', 'ad',
'litora', 'torquent', 'per', 'conubia', 'nostra', 'inceptos', 'himenaeos', 'phasellus', 'nibh', 'pulvinar', 'vitae', 'litora', 'torquent', 'per', 'conubia', 'nostra', 'inceptos', 'himenaeos', 'phasellus', 'nibh', 'pulvinar', 'vitae',
'urna', 'iaculis', 'lobortis', 'nisi', 'viverra', 'arcu', 'morbi', 'pellentesque', 'metus', 'commodo', 'ut', 'facilisis', 'urna', 'iaculis', 'lobortis', 'nisi', 'viverra', 'arcu', 'morbi', 'pellentesque', 'metus', 'commodo', 'ut', 'facilisis',
'felis', 'tristique', 'ullamcorper', 'placerat', 'aenean', 'convallis', 'sollicitudin', 'integer', 'rutrum', 'duis', 'est', 'felis', 'tristique', 'ullamcorper', 'placerat', 'aenean', 'convallis', 'sollicitudin', 'integer', 'rutrum', 'duis', 'est',
'etiam', 'bibendum', 'donec', 'pharetra', 'vulputate', 'maecenas', 'mi', 'fermentum', 'consequat', 'suscipit', 'aliquam', 'etiam', 'bibendum', 'donec', 'pharetra', 'vulputate', 'maecenas', 'mi', 'fermentum', 'consequat', 'suscipit', 'aliquam',
'habitant', 'senectus', 'netus', 'fames', 'quisque', 'euismod', 'curabitur', 'lectus', 'elementum', 'tempor', 'risus', 'habitant', 'senectus', 'netus', 'fames', 'quisque', 'euismod', 'curabitur', 'lectus', 'elementum', 'tempor', 'risus',
'cras', 'cras',
]; ];

View File

@ -36,7 +36,7 @@ class StringCompare
/** /**
* Constructor. * Constructor.
* *
* @param array $dictionary Dictionary * @param array $dictionary Dictionary
* *
* @since 1.0.0 * @since 1.0.0
@ -48,9 +48,9 @@ class StringCompare
/** /**
* Adds word to dictionary * Adds word to dictionary
* *
* @param string $word Word to add to dictionary * @param string $word Word to add to dictionary
* *
* @return void * @return void
* *
* @since 1.0.0 * @since 1.0.0
@ -177,5 +177,5 @@ class StringCompare
return min($phraseValue * $phraseWeight, $wordValue * $wordWeight) * $minWeight return min($phraseValue * $phraseWeight, $wordValue * $wordWeight) * $minWeight
+ max($phraseValue * $phraseWeight, $wordValue * $wordWeight) * $maxWeight + max($phraseValue * $phraseWeight, $wordValue * $wordWeight) * $maxWeight
+ $lengthValue * $lengthWeight; + $lengthValue * $lengthWeight;
} }
} }

View File

@ -350,7 +350,7 @@ class StringUtils
* *
* @param string $value String to analyze. * @param string $value String to analyze.
* *
* @return float * @return float
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -373,7 +373,7 @@ class StringUtils
* *
* @param string $input String to count chars. * @param string $input String to count chars.
* *
* @return array * @return array
* *
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -73,7 +73,7 @@ class Cron extends SchedulerAbstract
* *
* @since 1.0.0 * @since 1.0.0
*/ */
private function normalize(string $raw) : string private function normalize(string $raw) : string
{ {
return str_replace("\r\n", "\n", $raw); return str_replace("\r\n", "\n", $raw);
} }
@ -92,7 +92,7 @@ class Cron extends SchedulerAbstract
$jobs[] = CronJob::createWith(str_getcsv($line, ' ')); $jobs[] = CronJob::createWith(str_getcsv($line, ' '));
} }
} }
return $jobs; return $jobs;
} }

View File

@ -36,14 +36,14 @@ class Schedule extends TaskAbstract
$job->setRun($jobData[8]); $job->setRun($jobData[8]);
$job->setStatus($jobData[3]); $job->setStatus($jobData[3]);
if (DateTime::isValid($jobData[2])) { if (DateTime::isValid($jobData[2])) {
$job->setNextRunTime(new \DateTime($jobData[2])); $job->setNextRunTime(new \DateTime($jobData[2]));
} }
if (DateTime::isValid($jobData[5])) { if (DateTime::isValid($jobData[5])) {
$job->setLastRuntime(new \DateTime($jobData[5])); $job->setLastRuntime(new \DateTime($jobData[5]));
} }
$job->setComment($jobData[10]); $job->setComment($jobData[10]);
$job->addResult($jobData[6]); $job->addResult($jobData[6]);

View File

@ -90,7 +90,7 @@ abstract class SchedulerAbstract
/** /**
* Create task * Create task
* *
* @param TaskAbstract * @param TaskAbstract
* *
* @return void * @return void

View File

@ -74,7 +74,7 @@ abstract class TaskAbstract
/** /**
* Comment * Comment
* *
* @param string $name Name of the task * @param string $name Name of the task
* @param string $cmd Command/script to run * @param string $cmd Command/script to run
* *
@ -85,7 +85,7 @@ abstract class TaskAbstract
/** /**
* Constructor * Constructor
* *
* @param string $name Id/name of the task (on linux the same as the executable script) * @param string $name Id/name of the task (on linux the same as the executable script)
* @param string $cmd Command to create the task * @param string $cmd Command to create the task
* *
@ -222,7 +222,7 @@ abstract class TaskAbstract
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public function getLastRuntime() public function getLastRuntime()
{ {
return $this->lastRunTime; return $this->lastRunTime;
} }
@ -269,11 +269,11 @@ abstract class TaskAbstract
/** /**
* Create task based on job data * Create task based on job data
* *
* @param array $jobData Raw job data * @param array $jobData Raw job data
* *
* @return TaskAbstract * @return TaskAbstract
* *
* @since 1.0.0 * @since 1.0.0
*/ */
abstract public static function createWith(array $jobData) : TaskAbstract; abstract public static function createWith(array $jobData) : TaskAbstract;

View File

@ -72,7 +72,7 @@ class TaskScheduler extends SchedulerAbstract
* *
* @since 1.0.0 * @since 1.0.0
*/ */
private function normalize(string $raw) : string private function normalize(string $raw) : string
{ {
return str_replace("\r\n", "\n", $raw); return str_replace("\r\n", "\n", $raw);
} }
@ -89,7 +89,7 @@ class TaskScheduler extends SchedulerAbstract
foreach ($lines as $line) { foreach ($lines as $line) {
$jobs[] = Schedule::createWith(str_getcsv($line)); $jobs[] = Schedule::createWith(str_getcsv($line));
} }
return $jobs; return $jobs;
} }

View File

@ -38,26 +38,26 @@ class TestUtils
public static function setMember(/* object */ $obj, string $name, $value) : bool public static function setMember(/* object */ $obj, string $name, $value) : bool
{ {
$reflectionClass = new \ReflectionClass(is_string($obj) ? $obj : get_class($obj)); $reflectionClass = new \ReflectionClass(is_string($obj) ? $obj : get_class($obj));
if (!$reflectionClass->hasProperty($name)) { if (!$reflectionClass->hasProperty($name)) {
return false; return false;
} }
$reflectionProperty = $reflectionClass->getProperty($name); $reflectionProperty = $reflectionClass->getProperty($name);
if (!($accessible = $reflectionProperty->isPublic())) { if (!($accessible = $reflectionProperty->isPublic())) {
$reflectionProperty->setAccessible(true); $reflectionProperty->setAccessible(true);
} }
$reflectionProperty->setValue($obj, $value); $reflectionProperty->setValue($obj, $value);
if (!$accessible) { if (!$accessible) {
$reflectionProperty->setAccessible(false); $reflectionProperty->setAccessible(false);
} }
return true; return true;
} }
/** /**
* Get private object member * Get private object member
* *
@ -68,26 +68,26 @@ class TestUtils
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public static function getMember($obj, string $name) public static function getMember($obj, string $name)
{ {
$reflectionClass = new \ReflectionClass(is_string($obj) ? $obj : get_class($obj)); $reflectionClass = new \ReflectionClass(is_string($obj) ? $obj : get_class($obj));
if (!$reflectionClass->hasProperty($name)) { if (!$reflectionClass->hasProperty($name)) {
return null; return null;
} }
$reflectionProperty = $reflectionClass->getProperty($name); $reflectionProperty = $reflectionClass->getProperty($name);
if (!($accessible = $reflectionProperty->isPublic())) { if (!($accessible = $reflectionProperty->isPublic())) {
$reflectionProperty->setAccessible(true); $reflectionProperty->setAccessible(true);
} }
$value = $reflectionProperty->getValue($obj); $value = $reflectionProperty->getValue($obj);
if (!$accessible) { if (!$accessible) {
$reflectionProperty->setAccessible(false); $reflectionProperty->setAccessible(false);
} }
return $value; return $value;
} }
} }

View File

@ -20,6 +20,6 @@ class Barcode extends ValidatorAbstract
{ {
public static function isValid($value, array $constraints = null) public static function isValid($value, array $constraints = null)
{ {
} }
} }

View File

@ -20,6 +20,6 @@ class Barcode11 extends ValidatorAbstract
{ {
public static function isValid($value, array $constraints = null) public static function isValid($value, array $constraints = null)
{ {
} }
} }

View File

@ -20,6 +20,6 @@ class Barcode128 extends ValidatorAbstract
{ {
public static function isValid($value, array $constraints = null) public static function isValid($value, array $constraints = null)
{ {
} }
} }

View File

@ -20,6 +20,6 @@ class Barcode25 extends ValidatorAbstract
{ {
public static function isValid($value, array $constraints = null) public static function isValid($value, array $constraints = null)
{ {
} }
} }

View File

@ -20,6 +20,6 @@ class Barcode39 extends ValidatorAbstract
{ {
public static function isValid($value, array $constraints = null) public static function isValid($value, array $constraints = null)
{ {
} }
} }

View File

@ -20,6 +20,6 @@ class Barcode93 extends ValidatorAbstract
{ {
public static function isValid($value, array $constraints = null) public static function isValid($value, array $constraints = null)
{ {
} }
} }

View File

@ -20,6 +20,6 @@ class BarcodeCodebar extends ValidatorAbstract
{ {
public static function isValid($value, array $constraints = null) public static function isValid($value, array $constraints = null)
{ {
} }
} }

View File

@ -20,6 +20,6 @@ class BarcodeDatamatrix extends ValidatorAbstract
{ {
public static function isValid($value, array $constraints = null) public static function isValid($value, array $constraints = null)
{ {
} }
} }

View File

@ -20,6 +20,6 @@ class BarcodeEAN extends ValidatorAbstract
{ {
public static function isValid($value, array $constraints = null) public static function isValid($value, array $constraints = null)
{ {
} }
} }

View File

@ -20,6 +20,6 @@ class BarcodeMSI extends ValidatorAbstract
{ {
public static function isValid($value, array $constraints = null) public static function isValid($value, array $constraints = null)
{ {
} }
} }

View File

@ -20,6 +20,6 @@ class QrCode extends ValidatorAbstract
{ {
public static function isValid($value, array $constraints = null) public static function isValid($value, array $constraints = null)
{ {
} }
} }

View File

@ -158,7 +158,7 @@ class View extends ViewAbstract
* @param string $translation Text * @param string $translation Text
* @param string $module Module name * @param string $module Module name
* @param string $theme Theme name * @param string $theme Theme name
* *
* @return string * @return string
* *
* @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.
@ -201,7 +201,7 @@ class View extends ViewAbstract
* @param string $translation Text * @param string $translation Text
* @param string $module Module name * @param string $module Module name
* @param string $theme Theme name * @param string $theme Theme name
* *
* @return string * @return string
* *
* @since 1.0.0 * @since 1.0.0

View File

@ -155,7 +155,7 @@ abstract class ViewAbstract implements \Serializable
* *
* @since 1.0.0 <d.eichhorn@oms.com> * @since 1.0.0 <d.eichhorn@oms.com>
*/ */
public function addView(string $id, View $view, int $order = 0, bool $overwrite = true) : bool public function addView(string $id, View $view, int $order = 0, bool $overwrite = true) : bool
{ {
if ($overwrite || !isset($this->views[$id])) { if ($overwrite || !isset($this->views[$id])) {
$this->views[$id] = $view; $this->views[$id] = $view;
@ -163,10 +163,10 @@ abstract class ViewAbstract implements \Serializable
if ($order !== 0) { if ($order !== 0) {
uasort($this->views, ['\phpOMS\Views\View', 'viewSort']); uasort($this->views, ['\phpOMS\Views\View', 'viewSort']);
} }
return true; return true;
} }
return false; return false;
} }

View File

@ -59,6 +59,6 @@ class AccountManagerTest extends \PHPUnit\Framework\TestCase
self::assertTrue($manager->remove($account->getId())); self::assertTrue($manager->remove($account->getId()));
self::assertFalse($manager->remove(-1)); self::assertFalse($manager->remove(-1));
self::assertEquals(0, $manager->count()); self::assertEquals(0, $manager->count());
} }
} }

View File

@ -23,7 +23,7 @@ class PermissionTypeTest extends \PHPUnit\Framework\TestCase
{ {
self::assertEquals(6, count(PermissionType::getConstants())); self::assertEquals(6, count(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);
self::assertEquals(2, PermissionType::READ); self::assertEquals(2, PermissionType::READ);
self::assertEquals(4, PermissionType::CREATE); self::assertEquals(4, PermissionType::CREATE);

View File

@ -22,7 +22,7 @@ class ApplicationAbstractTest extends \PHPUnit\Framework\TestCase
public function testGetSet() public function testGetSet()
{ {
$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

@ -11,9 +11,9 @@ use phpOMS\DataStorage\Database\DatabasePool;
use phpOMS\DataStorage\Database\DataMapperAbstract; use phpOMS\DataStorage\Database\DataMapperAbstract;
// Reset database // Reset database
$db = new \PDO($CONFIG['db']['core']['masters']['admin']['db'] . ':host=' . $db = new \PDO($CONFIG['db']['core']['masters']['admin']['db'] . ':host=' .
$CONFIG['db']['core']['masters']['admin']['host'], $CONFIG['db']['core']['masters']['admin']['host'],
$CONFIG['db']['core']['masters']['admin']['login'], $CONFIG['db']['core']['masters']['admin']['login'],
$CONFIG['db']['core']['masters']['admin']['password'] $CONFIG['db']['core']['masters']['admin']['password']
); );
$db->exec('DROP DATABASE IF EXISTS ' . $CONFIG['db']['core']['masters']['admin']['database']); $db->exec('DROP DATABASE IF EXISTS ' . $CONFIG['db']['core']['masters']['admin']['database']);

View File

@ -14,7 +14,6 @@
namespace phpOMS\tests\Business\Finance; namespace phpOMS\tests\Business\Finance;
use phpOMS\Business\Finance\Depreciation; use phpOMS\Business\Finance\Depreciation;
class DepreciationTest extends \PHPUnit\Framework\TestCase class DepreciationTest extends \PHPUnit\Framework\TestCase

View File

@ -16,7 +16,6 @@ namespace phpOMS\tests\Business\Finance;
use phpOMS\Business\Finance\FinanceFormulas; use phpOMS\Business\Finance\FinanceFormulas;
class FinanceFormulasTest extends \PHPUnit\Framework\TestCase class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
{ {
public function testAnnualPercentageYield() public function testAnnualPercentageYield()

View File

@ -14,7 +14,6 @@
namespace phpOMS\tests\Business\Finance\Forecasting; namespace phpOMS\tests\Business\Finance\Forecasting;
use phpOMS\Business\Finance\Forecasting\ARCH; use phpOMS\Business\Finance\Forecasting\ARCH;
class ARCHTest extends \PHPUnit\Framework\TestCase class ARCHTest extends \PHPUnit\Framework\TestCase

View File

@ -14,7 +14,6 @@
namespace phpOMS\tests\Business\Finance\Forecasting; namespace phpOMS\tests\Business\Finance\Forecasting;
use phpOMS\Business\Finance\Forecasting\ARFIMA; use phpOMS\Business\Finance\Forecasting\ARFIMA;
class ARFIMATest extends \PHPUnit\Framework\TestCase class ARFIMATest extends \PHPUnit\Framework\TestCase

View File

@ -14,7 +14,6 @@
namespace phpOMS\tests\Business\Finance\Forecasting; namespace phpOMS\tests\Business\Finance\Forecasting;
use phpOMS\Business\Finance\Forecasting\ARIMA; use phpOMS\Business\Finance\Forecasting\ARIMA;
class ARIMATest extends \PHPUnit\Framework\TestCase class ARIMATest extends \PHPUnit\Framework\TestCase

View File

@ -14,7 +14,6 @@
namespace phpOMS\tests\Business\Finance\Forecasting; namespace phpOMS\tests\Business\Finance\Forecasting;
use phpOMS\Business\Finance\Forecasting\ARMA; use phpOMS\Business\Finance\Forecasting\ARMA;
class ARMATest extends \PHPUnit\Framework\TestCase class ARMATest extends \PHPUnit\Framework\TestCase

View File

@ -14,7 +14,6 @@
namespace phpOMS\tests\Business\Finance\Forecasting; namespace phpOMS\tests\Business\Finance\Forecasting;
use phpOMS\Business\Finance\Forecasting\AR; use phpOMS\Business\Finance\Forecasting\AR;
class ARTest extends \PHPUnit\Framework\TestCase class ARTest extends \PHPUnit\Framework\TestCase

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