mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-25 07:38:40 +00:00
Finalize new tests
This commit is contained in:
parent
b326f71086
commit
58e6b89768
|
|
@ -21,9 +21,9 @@ use phpOMS\Validation\Network\Email;
|
|||
|
||||
/**
|
||||
* Account class.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @package phpOMS\Account
|
||||
* @license OMS License 1.0
|
||||
|
|
@ -157,7 +157,7 @@ class Account implements ArrayableInterface, \JsonSerializable
|
|||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
*
|
||||
* The constructor automatically sets the created date as well as the last activity to now.
|
||||
*
|
||||
* @param int $id Account id
|
||||
|
|
@ -186,7 +186,7 @@ class Account implements ArrayableInterface, \JsonSerializable
|
|||
|
||||
/**
|
||||
* Get localization.
|
||||
*
|
||||
*
|
||||
* Every account can have a different localization which can be accessed here.
|
||||
*
|
||||
* @return Localization
|
||||
|
|
@ -200,8 +200,8 @@ class Account implements ArrayableInterface, \JsonSerializable
|
|||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @return array Returns array of all groups
|
||||
|
|
@ -215,9 +215,9 @@ class Account implements ArrayableInterface, \JsonSerializable
|
|||
|
||||
/**
|
||||
* Add group.
|
||||
*
|
||||
*
|
||||
* @param mixed $group Group to add
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -243,7 +243,7 @@ class Account implements ArrayableInterface, \JsonSerializable
|
|||
|
||||
/**
|
||||
* Set permissions.
|
||||
*
|
||||
*
|
||||
* The method accepts an array of permissions. All existing permissions are replaced.
|
||||
*
|
||||
* @param PermissionAbstract[] $permissions
|
||||
|
|
@ -259,7 +259,7 @@ class Account implements ArrayableInterface, \JsonSerializable
|
|||
|
||||
/**
|
||||
* Add permissions.
|
||||
*
|
||||
*
|
||||
* Adds permissions 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.
|
||||
*
|
||||
*
|
||||
* Adds a single permission to the account
|
||||
*
|
||||
* @param PermissionAbstract $permission Permission to add to the account
|
||||
|
|
@ -291,7 +291,7 @@ class Account implements ArrayableInterface, \JsonSerializable
|
|||
|
||||
/**
|
||||
* Get permissions.
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -305,7 +305,7 @@ class Account implements ArrayableInterface, \JsonSerializable
|
|||
* Has permissions.
|
||||
*
|
||||
* Checks if the account has a permission defined
|
||||
*
|
||||
*
|
||||
* @param int $permission Permission to check
|
||||
* @param int $unit Unit Unit 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) {
|
||||
if (($p->getUnit() === $unit || $p->getUnit() === null || !isset($unit))
|
||||
&& ($p->getApp() === $app || $p->getApp() === null || !isset($app))
|
||||
&& ($p->getModule() === $module || $p->getModule() === null || !isset($module))
|
||||
&& ($p->getType() === $type || $p->getType() === null || !isset($type))
|
||||
&& ($p->getElement() === $element || $p->getElement() === null || !isset($element))
|
||||
&& ($p->getComponent() === $component || $p->getComponent() === null || !isset($component))
|
||||
&& ($p->getApp() === $app || $p->getApp() === null || !isset($app))
|
||||
&& ($p->getModule() === $module || $p->getModule() === null || !isset($module))
|
||||
&& ($p->getType() === $type || $p->getType() === null || !isset($type))
|
||||
&& ($p->getElement() === $element || $p->getElement() === null || !isset($element))
|
||||
&& ($p->getComponent() === $component || $p->getComponent() === null || !isset($component))
|
||||
&& ($p->getPermission() | $permission) === $p->getPermission()) {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -445,7 +445,7 @@ class Account implements ArrayableInterface, \JsonSerializable
|
|||
* @param string $email Email
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
*
|
||||
* @throws \InvalidArgumentException Exception is thrown if the provided string is not a valid email
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -553,7 +553,7 @@ class Account implements ArrayableInterface, \JsonSerializable
|
|||
* @param string $password Password
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
*
|
||||
* @throws \Exception
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -628,7 +628,7 @@ class Account implements ArrayableInterface, \JsonSerializable
|
|||
|
||||
/**
|
||||
* Json serialize.
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ use phpOMS\DataStorage\Session\SessionInterface;
|
|||
|
||||
/**
|
||||
* Account manager class.
|
||||
*
|
||||
* The account manager is used to manage multiple accounts.
|
||||
*
|
||||
* The account manager is used to manage multiple accounts.
|
||||
*
|
||||
* @package phpOMS\Account
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ namespace phpOMS\Account;
|
|||
|
||||
/**
|
||||
* Permission class.
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
|
|
@ -342,7 +342,7 @@ class PermissionAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function hasPermission(int $permission) : bool
|
||||
public function hasPermission(int $permission) : bool
|
||||
{
|
||||
return ($this->permission | $permission) === $this->permission;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ class ApplicationAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function __set($name, $value)
|
||||
public function __set($name, $value)
|
||||
{
|
||||
if (!empty($this->$name)) {
|
||||
return;
|
||||
|
|
@ -175,8 +175,8 @@ class ApplicationAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function __get($name)
|
||||
{
|
||||
return $this->$name;
|
||||
public function __get($name)
|
||||
{
|
||||
return $this->$name;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ namespace phpOMS\Business\Marketing;
|
|||
|
||||
/**
|
||||
* Marketing Metrics
|
||||
*
|
||||
*
|
||||
* This class provided basic marketing metric calculations
|
||||
*
|
||||
* @package phpOMS\Business\Marketing
|
||||
|
|
@ -27,9 +27,9 @@ namespace phpOMS\Business\Marketing;
|
|||
class Metrics {
|
||||
/**
|
||||
* Calculate customer retention
|
||||
*
|
||||
*
|
||||
* @latex r = \frac{ce - cn}{cs}
|
||||
*
|
||||
*
|
||||
* @param int $ce Customer at the end of the period
|
||||
* @param int $cn New customers during period
|
||||
* @param int $cs Customers at the start of the period
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ namespace phpOMS\Business\Marketing;
|
|||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @package phpOMS\Business\Marketing
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ namespace phpOMS\Business\Programming;
|
|||
|
||||
/**
|
||||
* Programming metrics
|
||||
*
|
||||
*
|
||||
* This class provides basic programming metric calculations.
|
||||
*
|
||||
* @package phpOMS\Business\Programming
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ namespace phpOMS\Business\Sales;
|
|||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @package phpOMS\Business\Sales
|
||||
|
|
@ -45,10 +45,10 @@ class MarketShareEstimation {
|
|||
for ($i = 0; $i < $participants; $i++) {
|
||||
$sum += 1 / pow($i + 1, $modifier);
|
||||
}
|
||||
|
||||
|
||||
return (int) round(pow(1 / ($marketShare * $sum), 1 / $modifier));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Calculate market share (m) based on rank (r)
|
||||
*
|
||||
|
|
@ -68,7 +68,7 @@ class MarketShareEstimation {
|
|||
for ($i = 0; $i < $participants; $i++) {
|
||||
$sum += 1 / pow($i + 1, $modifier);
|
||||
}
|
||||
|
||||
|
||||
return (1 / pow($rank, $modifier)) / $sum;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -276,7 +276,7 @@ class FileCache implements CacheInterface
|
|||
if (!File::exists($path)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
$created = Directory::created($path)->getTimestamp();
|
||||
$now = time();
|
||||
|
||||
|
|
@ -300,7 +300,7 @@ class FileCache implements CacheInterface
|
|||
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;
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class MemCache implements CacheInterface
|
|||
* @since 1.0.0
|
||||
*/
|
||||
private $threshold = 10;
|
||||
|
||||
|
||||
private $status;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ class MysqlConnection extends ConnectionAbstract
|
|||
public function connect(array $dbdata = null) /* : void */
|
||||
{
|
||||
$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'])) {
|
||||
throw new InvalidConnectionConfigException(json_encode($this->dbdata));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ class DataMapperAbstract implements DataMapperInterface
|
|||
|
||||
/**
|
||||
* Clone.
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -194,7 +194,7 @@ class DataMapperAbstract implements DataMapperInterface
|
|||
* Set database connection.
|
||||
*
|
||||
* @param ConnectionAbstract $con Database connection
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -499,7 +499,7 @@ class DataMapperAbstract implements DataMapperInterface
|
|||
*
|
||||
* @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);
|
||||
$reflectionProperty = $reflectionClass->getProperty(static::$columns[static::$primaryField]['internal']);
|
||||
|
|
@ -918,8 +918,8 @@ class DataMapperAbstract implements DataMapperInterface
|
|||
$objsIds[$propertyName][$key] = $value;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!isset($relReflectionClass)) {
|
||||
$relReflectionClass = new \ReflectionClass($value);
|
||||
}
|
||||
|
|
@ -1168,7 +1168,7 @@ class DataMapperAbstract implements DataMapperInterface
|
|||
if ($relations === RelationType::ALL) {
|
||||
self::updateHasMany($reflectionClass, $obj, $objId);
|
||||
}
|
||||
|
||||
|
||||
if ($update) {
|
||||
self::updateModel($obj, $objId, $reflectionClass);
|
||||
}
|
||||
|
|
@ -1220,8 +1220,8 @@ class DataMapperAbstract implements DataMapperInterface
|
|||
$objsIds[$key] = $value;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!isset($relReflectionClass)) {
|
||||
$relReflectionClass = new \ReflectionClass($value);
|
||||
}
|
||||
|
|
@ -1240,7 +1240,7 @@ class DataMapperAbstract implements DataMapperInterface
|
|||
}
|
||||
|
||||
// todo: could be a problem, relation needs to be removed first?!
|
||||
|
||||
|
||||
}
|
||||
|
||||
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: support other relation types as well (belongsto, ownsone) = for better control
|
||||
|
||||
|
||||
foreach (static::$columns as $key => $column) {
|
||||
if ($relations === RelationType::ALL && isset(static::$ownsOne[$propertyName]) && $column['internal'] === $propertyName) {
|
||||
self::deleteOwnsOne($propertyName, $property->getValue($obj));
|
||||
|
|
@ -1378,7 +1378,7 @@ class DataMapperAbstract implements DataMapperInterface
|
|||
if ($relations !== RelationType::NONE) {
|
||||
self::deleteHasMany($reflectionClass, $obj, $objId, $relations);
|
||||
}
|
||||
|
||||
|
||||
self::deleteModel($obj, $objId, $relations, $reflectionClass);
|
||||
|
||||
return $objId;
|
||||
|
|
@ -1467,7 +1467,7 @@ class DataMapperAbstract implements DataMapperInterface
|
|||
* @param array[] $result Result set
|
||||
* @param mixed $obj Object to add the relations to
|
||||
* @param int $depth Relation depth
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -1526,7 +1526,7 @@ class DataMapperAbstract implements DataMapperInterface
|
|||
*
|
||||
* @param mixed $obj Object to add the relations to
|
||||
* @param int $depth Relation depth
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @todo accept reflection class as parameter
|
||||
|
|
@ -1549,11 +1549,11 @@ class DataMapperAbstract implements DataMapperInterface
|
|||
/** @var string $mapper */
|
||||
$mapper = static::$hasOne[$member]['mapper'];
|
||||
$id = $reflectionProperty->getValue($obj);
|
||||
|
||||
|
||||
if (self::isNullObject($id)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
$id = is_object($id) ? self::getObjectId($id) : $id;
|
||||
$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 int $depth Relation depth
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @todo accept reflection class as parameter
|
||||
|
|
@ -1736,7 +1736,7 @@ class DataMapperAbstract implements DataMapperInterface
|
|||
$reflectionClass = new \ReflectionClass($obj);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -1815,7 +1815,7 @@ class DataMapperAbstract implements DataMapperInterface
|
|||
* @param int $depth Relation depth
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
*
|
||||
* @todo: implement language
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -2578,7 +2578,7 @@ class DataMapperAbstract implements DataMapperInterface
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private static function getInitialized(string $mapper, $id)
|
||||
private static function getInitialized(string $mapper, $id)
|
||||
{
|
||||
return self::$initObjects[$mapper][$id] ?? null;
|
||||
}
|
||||
|
|
@ -2631,7 +2631,7 @@ class DataMapperAbstract implements DataMapperInterface
|
|||
|
||||
$sth = self::$db->con->prepare($query->toSql());
|
||||
$sth->execute();
|
||||
|
||||
|
||||
$results = $sth->fetchAll(\PDO::FETCH_ASSOC);
|
||||
|
||||
return count($results) === 0;
|
||||
|
|
@ -2643,7 +2643,7 @@ class DataMapperAbstract implements DataMapperInterface
|
|||
* @param string $name member name
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
*
|
||||
* @throws \Exception Throws this exception if the member couldn't be found
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -2665,7 +2665,7 @@ class DataMapperAbstract implements DataMapperInterface
|
|||
* @param object $obj Object to check
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private static function isNullObject($obj) : bool
|
||||
|
|
|
|||
|
|
@ -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?
|
||||
$identifier = $this->systemIdentifier;
|
||||
|
||||
|
||||
foreach ($this->specialKeywords as $keyword) {
|
||||
if (strrpos($system, $keyword, -strlen($system)) !== false) {
|
||||
$prefix = '';
|
||||
|
|
|
|||
|
|
@ -377,7 +377,7 @@ class Builder extends BuilderAbstract
|
|||
|
||||
$test = strtolower($raw);
|
||||
|
||||
if (strpos($test, 'insert') !== false
|
||||
if (strpos($test, 'insert') !== false
|
||||
|| strpos($test, 'update') !== false
|
||||
|| strpos($test, 'drop') !== false
|
||||
|| strpos($test, 'delete') !== false
|
||||
|
|
@ -1120,18 +1120,18 @@ class Builder extends BuilderAbstract
|
|||
public function execute()
|
||||
{
|
||||
$sth = $this->connection->con->prepare($this->toSql());
|
||||
|
||||
|
||||
foreach ($this->binds as $key => $bind) {
|
||||
$type = self::getBindParamType($bind);
|
||||
|
||||
|
||||
$sth->bindParam($key, $bind, $type);
|
||||
}
|
||||
|
||||
|
||||
$sth->execute();
|
||||
|
||||
return $sth;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get bind parameter type.
|
||||
*
|
||||
|
|
@ -1150,7 +1150,7 @@ class Builder extends BuilderAbstract
|
|||
} elseif (is_string($value) || is_float($value)) {
|
||||
return \PDO::PARAM_STR;
|
||||
}
|
||||
|
||||
|
||||
throw new \Exception();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ class Grammar extends GrammarAbstract
|
|||
}
|
||||
|
||||
$components = $this->getComponents($query->getType());
|
||||
|
||||
|
||||
/* Loop all possible query components and if they exist compile them. */
|
||||
foreach ($components as $component) {
|
||||
if (isset($query->{$component}) && !empty($query->{$component})) {
|
||||
|
|
@ -192,7 +192,7 @@ class Grammar extends GrammarAbstract
|
|||
protected function compileUpdates(Builder $query, array $table) : string
|
||||
{
|
||||
$expression = $this->expressionizeTable($table, $query->getPrefix());
|
||||
|
||||
|
||||
if ($expression === '') {
|
||||
return '';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ class HttpSession implements SessionInterface
|
|||
* @since 1.0.0
|
||||
*/
|
||||
private $sid = null;
|
||||
|
||||
|
||||
/**
|
||||
* Inactivity Interval.
|
||||
*
|
||||
|
|
@ -85,23 +85,23 @@ class HttpSession implements SessionInterface
|
|||
if (!is_bool($sid)) {
|
||||
session_id($sid);
|
||||
}
|
||||
|
||||
|
||||
$this->inactivityInterval = $inactivityInterval;
|
||||
|
||||
if (session_status() !== PHP_SESSION_ACTIVE && !headers_sent()) {
|
||||
session_set_cookie_params($liftetime, '/', '', false, true);
|
||||
session_start();
|
||||
}
|
||||
|
||||
|
||||
if ($this->inactivityInterval > 0 && ($this->inactivityInterval + ($_SESSION['lastActivity'] ?? 0) < time())) {
|
||||
$this->destroy();
|
||||
}
|
||||
|
||||
|
||||
$this->sessionData = $_SESSION;
|
||||
$_SESSION = null;
|
||||
$this->sessionData['lastActivity'] = time();
|
||||
$this->sid = session_id();
|
||||
|
||||
|
||||
$this->setCsrfProtection();
|
||||
}
|
||||
|
||||
|
|
@ -204,7 +204,7 @@ class HttpSession implements SessionInterface
|
|||
{
|
||||
$this->sid = $sid;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Destroy the current session.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ interface SessionInterface
|
|||
|
||||
/**
|
||||
* Lock session from further adjustments.
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class Builder extends DatabaseQueryBuilder
|
|||
{
|
||||
$finder = [];
|
||||
$l11n = new Localization();
|
||||
|
||||
|
||||
foreach ($this->from as $from) {
|
||||
$doc = new \DOMDocument();
|
||||
$doc->loadHTML(Rest::request($l11n, new Http($from)));
|
||||
|
|
@ -42,12 +42,12 @@ class Builder extends DatabaseQueryBuilder
|
|||
|
||||
return $finder;
|
||||
}
|
||||
|
||||
|
||||
public function get(string $xpath)
|
||||
{
|
||||
$nodes = $finder->query($xpath);
|
||||
}
|
||||
|
||||
|
||||
public function execute()
|
||||
{
|
||||
$finder = $this->download();
|
||||
|
|
@ -92,7 +92,7 @@ class Builder extends DatabaseQueryBuilder
|
|||
foreach ($children as $child) {
|
||||
$table[] = $child->asXML();
|
||||
}
|
||||
|
||||
|
||||
return $table;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ class L11nManager
|
|||
} elseif (isset($this->language[$language], $this->language[$language][$module])) {
|
||||
return $this->language[$language][$module];
|
||||
}
|
||||
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -219,7 +219,7 @@ class Localization
|
|||
public function setLanguage(string $language) /* : void */
|
||||
{
|
||||
$language = strtolower($language);
|
||||
|
||||
|
||||
if (!ISO639x1Enum::isValidValue($language)) {
|
||||
throw new InvalidEnumValue($language);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ class Money implements \Serializable
|
|||
$this->value += $value;
|
||||
} elseif ($value instanceof Money) {
|
||||
$this->value += $value->getInt();
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
@ -242,7 +242,7 @@ class Money implements \Serializable
|
|||
$this->value -= $value;
|
||||
} elseif ($value instanceof Money) {
|
||||
$this->value -= $value->getInt();
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ class Polygon implements D2ShapeInterface
|
|||
* @param array $polygon Polygon definition
|
||||
*
|
||||
* @return int -1 inside polygon 0 on vertice 1 outside
|
||||
*
|
||||
*
|
||||
* @link http://erich.realtimerendering.com/ptinpoly/
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -88,18 +88,18 @@ class CholeskyDecomposition
|
|||
for ($i = 0; $i < $k ; $i++) {
|
||||
$X[$k][$j] -= $X[$i][$j] * $this->L[$k][$i];
|
||||
}
|
||||
|
||||
|
||||
$X[$k][$j] /= $this->L[$k][$k];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Solve L'*X = Y;
|
||||
for ($k = $this->m - 1; $k >= 0; $k--) {
|
||||
for ($j = 0; $j < $n; $j++) {
|
||||
for ($i = $k + 1; $i < $this->m ; $i++) {
|
||||
$X[$k][$j] -= $X[$i][$j] * $this->L[$i][$k];
|
||||
}
|
||||
|
||||
|
||||
$X[$k][$j] /= $this->L[$k][$k];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ class LUDecomposition
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$matrix = new Matrix();
|
||||
$matrix->setMatrix($L);
|
||||
|
||||
|
|
@ -117,7 +117,7 @@ class LUDecomposition
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$matrix = new Matrix();
|
||||
$matrix->setMatrix($U);
|
||||
|
||||
|
|
@ -136,11 +136,11 @@ class LUDecomposition
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function det()
|
||||
public function det()
|
||||
{
|
||||
$d = $this->pivSign;
|
||||
for ($j = 0; $j < $this->n; ++$j) {
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ class Matrix implements \ArrayAccess, \Iterator
|
|||
*
|
||||
* @param array $matrix Matrix
|
||||
*
|
||||
* @return Matrix
|
||||
* @return Matrix
|
||||
*
|
||||
* @throws \Exception
|
||||
*
|
||||
|
|
@ -566,7 +566,7 @@ class Matrix implements \ArrayAccess, \Iterator
|
|||
return $M->solve($B);
|
||||
}
|
||||
|
||||
private function gaussElimination($b) : Matrix
|
||||
private function gaussElimination($b) : Matrix
|
||||
{
|
||||
$mDim = count($b);
|
||||
$matrix = $this->matrix;
|
||||
|
|
@ -583,17 +583,17 @@ class Matrix implements \ArrayAccess, \Iterator
|
|||
$max = $temp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($col != $j) {
|
||||
$temp = $matrix[$col];
|
||||
$matrix[$col] = $matrix[$j];
|
||||
$matrix[$j] = $temp;
|
||||
|
||||
|
||||
$temp = $b[$col];
|
||||
$b[$col] = $b[$j];
|
||||
$b[$j] = $temp;
|
||||
}
|
||||
|
||||
|
||||
for ($i = $col + 1; $i < $mDim; $i++) {
|
||||
$temp = $matrix[$i][$col] / $matrix[$col][$col];
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class QRDecomposition
|
|||
$this->QR = $M->toArray();
|
||||
$this->m = $M->getRowDimension();
|
||||
$this->n = $M->getColumnDimension();
|
||||
|
||||
|
||||
// Main loop.
|
||||
for ($k = 0; $k < $this->n; ++$k) {
|
||||
// Compute 2-norm of k-th column without under/overflow.
|
||||
|
|
@ -37,17 +37,17 @@ class QRDecomposition
|
|||
for ($i = $k; $i < $this->m; ++$i) {
|
||||
$nrm = hypo($nrm, $this->QR[$i][$k]);
|
||||
}
|
||||
|
||||
|
||||
if ($nrm != 0.0) {
|
||||
// Form k-th Householder vector.
|
||||
if ($this->QR[$k][$k] < 0) {
|
||||
$nrm = -$nrm;
|
||||
}
|
||||
|
||||
|
||||
for ($i = $k; $i < $this->m; ++$i) {
|
||||
$this->QR[$i][$k] /= $nrm;
|
||||
}
|
||||
|
||||
|
||||
$this->QR[$k][$k] += 1.0;
|
||||
// Apply transformation to remaining columns.
|
||||
for ($j = $k + 1; $j < $this->n; ++$j) {
|
||||
|
|
@ -55,14 +55,14 @@ class QRDecomposition
|
|||
for ($i = $k; $i < $this->m; ++$i) {
|
||||
$s += $this->QR[$i][$k] * $this->QR[$i][$j];
|
||||
}
|
||||
|
||||
|
||||
$s = -$s / $this->QR[$k][$k];
|
||||
for ($i = $k; $i < $this->m; ++$i) {
|
||||
$this->QR[$i][$j] += $s * $this->QR[$i][$k];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->Rdiag[$k] = -$nrm;
|
||||
}
|
||||
}
|
||||
|
|
@ -74,7 +74,7 @@ class QRDecomposition
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -91,7 +91,7 @@ class QRDecomposition
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$matrix = new Matrix();
|
||||
$matrix->setArray($H);
|
||||
|
||||
|
|
@ -113,7 +113,7 @@ class QRDecomposition
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$matrix = new Matrix();
|
||||
$matrix->setArray($R);
|
||||
|
||||
|
|
@ -128,7 +128,7 @@ class QRDecomposition
|
|||
for ($i = 0; $i < $this->m; ++$i) {
|
||||
$Q[$i][$k] = 0.0;
|
||||
}
|
||||
|
||||
|
||||
$Q[$k][$k] = 1.0;
|
||||
for ($j = $k; $j < $this->n; ++$j) {
|
||||
if ($this->QR[$k][$k] != 0) {
|
||||
|
|
@ -143,7 +143,7 @@ class QRDecomposition
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$matrix = new Matrix();
|
||||
$matrix->setArray($Q);
|
||||
|
||||
|
|
|
|||
|
|
@ -23,19 +23,19 @@ namespace phpOMS\Math\Stochastic;
|
|||
class NaiveBayesFilter
|
||||
{
|
||||
private $dict = [];
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public function trainMatch($matched) /* : void */
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public function trainMismatch($mismatch) /* : void */
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public function match($toMatch) : float
|
||||
{
|
||||
$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']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 1 / (1 + exp($n));
|
||||
}
|
||||
|
||||
|
||||
private function normalizeDictionary() : array
|
||||
{
|
||||
return $this->dict;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ abstract class HeaderAbstract
|
|||
* @since 1.0.0
|
||||
*/
|
||||
protected static $isLocked = false;
|
||||
|
||||
|
||||
/**
|
||||
* Localization.
|
||||
*
|
||||
|
|
@ -41,7 +41,7 @@ abstract class HeaderAbstract
|
|||
* @since 1.0.0
|
||||
*/
|
||||
protected $l11n = null;
|
||||
|
||||
|
||||
/**
|
||||
* Account.
|
||||
*
|
||||
|
|
@ -49,7 +49,7 @@ abstract class HeaderAbstract
|
|||
* @since 1.0.0
|
||||
*/
|
||||
protected $account = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Response status.
|
||||
*
|
||||
|
|
@ -67,7 +67,7 @@ abstract class HeaderAbstract
|
|||
{
|
||||
$this->l11n = new Localization();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set header locked.
|
||||
*
|
||||
|
|
@ -78,7 +78,7 @@ abstract class HeaderAbstract
|
|||
// todo: maybe pass session as member and make lock not static
|
||||
self::$isLocked = true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Is header locked?
|
||||
*
|
||||
|
|
@ -107,7 +107,7 @@ abstract class HeaderAbstract
|
|||
* Set localization
|
||||
*
|
||||
* @param Localization $l11n Localization
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -133,7 +133,7 @@ abstract class HeaderAbstract
|
|||
* Set account id
|
||||
*
|
||||
* @param int $account Account id
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -142,12 +142,12 @@ abstract class HeaderAbstract
|
|||
{
|
||||
$this->account = $account;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set status code
|
||||
*
|
||||
* @param int $status Status code
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ class Header extends HeaderAbstract
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Is security header.
|
||||
*
|
||||
|
|
@ -129,7 +129,7 @@ class Header extends HeaderAbstract
|
|||
if ($this->status === 0) {
|
||||
$this->status = (int) \http_response_code();
|
||||
}
|
||||
|
||||
|
||||
return parent::getStatusCode();
|
||||
}
|
||||
|
||||
|
|
@ -146,12 +146,12 @@ class Header extends HeaderAbstract
|
|||
return getallheaders();
|
||||
}
|
||||
|
||||
$headers = [];
|
||||
foreach ($_SERVER as $name => $value) {
|
||||
if (substr($name, 0, 5) == 'HTTP_') {
|
||||
$headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
|
||||
}
|
||||
}
|
||||
$headers = [];
|
||||
foreach ($_SERVER as $name => $value) {
|
||||
if (substr($name, 0, 5) == 'HTTP_') {
|
||||
$headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $headers;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@ class Request extends RequestAbstract
|
|||
{
|
||||
$this->hash = [];
|
||||
$pathArray = $this->uri->getPathElements();
|
||||
|
||||
|
||||
foreach ($pathArray as $key => $path) {
|
||||
$paths = [];
|
||||
for ($i = $start; $i < $key + 1; $i++) {
|
||||
|
|
@ -285,7 +285,7 @@ class Request extends RequestAbstract
|
|||
foreach ($arr as $key => $val) {
|
||||
if (stripos($httpUserAgent, $val)) {
|
||||
$this->browser = $val;
|
||||
|
||||
|
||||
return $this->browser;
|
||||
}
|
||||
}
|
||||
|
|
@ -320,11 +320,11 @@ class Request extends RequestAbstract
|
|||
if (!isset($this->os)) {
|
||||
$arr = OSType::getConstants();
|
||||
$httpUserAgent = strtolower($_SERVER['HTTP_USER_AGENT']);
|
||||
|
||||
|
||||
foreach ($arr as $key => $val) {
|
||||
if (stripos($httpUserAgent, $val)) {
|
||||
$this->os = $val;
|
||||
|
||||
|
||||
return $this->os;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ class Response extends ResponseAbstract implements RenderableInterface
|
|||
}
|
||||
|
||||
$types = $this->header->get('Content-Type');
|
||||
|
||||
|
||||
if (stripos($types[0], MimeType::M_HTML) !== false) {
|
||||
return trim(preg_replace('/(\s{2,}|\n|\t)(?![^<>]*<\/pre>)/', ' ', $render));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ class EmailAbstract
|
|||
*
|
||||
* @param string $user Username
|
||||
* @param string $pass Password
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -408,7 +408,7 @@ class EmailAbstract
|
|||
|
||||
/**
|
||||
* Create mailbox
|
||||
*
|
||||
*
|
||||
* @param string $mailbox Mailbox to create
|
||||
*
|
||||
* @return bool
|
||||
|
|
@ -422,7 +422,7 @@ class EmailAbstract
|
|||
|
||||
/**
|
||||
* Rename mailbox
|
||||
*
|
||||
*
|
||||
* @param string $old Old mailbox name
|
||||
* @param string $new New mailbox name
|
||||
*
|
||||
|
|
@ -437,7 +437,7 @@ class EmailAbstract
|
|||
|
||||
/**
|
||||
* Delete mailbox
|
||||
*
|
||||
*
|
||||
* @param string $mailbox Mailbox to delete
|
||||
*
|
||||
* @return bool
|
||||
|
|
@ -451,7 +451,7 @@ class EmailAbstract
|
|||
|
||||
/**
|
||||
* Check message to delete
|
||||
*
|
||||
*
|
||||
* @param int $id Message id
|
||||
*
|
||||
* @return bool
|
||||
|
|
@ -465,7 +465,7 @@ class EmailAbstract
|
|||
|
||||
/**
|
||||
* Delete all marked messages
|
||||
*
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -477,7 +477,7 @@ class EmailAbstract
|
|||
|
||||
/**
|
||||
* Check message to delete
|
||||
*
|
||||
*
|
||||
* @param int $length Amount of message overview
|
||||
* @param int $start Start index of the overview for pagination
|
||||
*
|
||||
|
|
@ -497,7 +497,7 @@ class EmailAbstract
|
|||
|
||||
/**
|
||||
* Count messages
|
||||
*
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -509,7 +509,7 @@ class EmailAbstract
|
|||
|
||||
/**
|
||||
* Get message header
|
||||
*
|
||||
*
|
||||
* @param int $id Message id
|
||||
*
|
||||
* @return string
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class Imap extends EmailAbstract
|
|||
*
|
||||
* @param string $user Username
|
||||
* @param string $pass Password
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class Nntp extends EmailAbstract
|
|||
*
|
||||
* @param string $user Username
|
||||
* @param string $pass Password
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class Pop3 extends EmailAbstract
|
|||
*
|
||||
* @param string $user Username
|
||||
* @param string $pass Password
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@ abstract class RequestAbstract implements MessageInterface
|
|||
* Get data.
|
||||
*
|
||||
* @param mixed $key Data key
|
||||
*
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -221,7 +221,7 @@ abstract class RequestAbstract implements MessageInterface
|
|||
* Check if has data.
|
||||
*
|
||||
* @param mixed $key Data key
|
||||
*
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ class ModuleManager
|
|||
|
||||
$i = 1;
|
||||
$c = count($uriHash);
|
||||
|
||||
|
||||
for ($k = 0; $k < $c; $k++) {
|
||||
$uriPdo .= ':pid' . $i . ',';
|
||||
$i++;
|
||||
|
|
@ -182,7 +182,7 @@ class ModuleManager
|
|||
|
||||
/**
|
||||
* Get all installed modules that are active (not just on this uri).
|
||||
*
|
||||
*
|
||||
* @param bool $useCache Use Cache or load new
|
||||
*
|
||||
* @return array
|
||||
|
|
@ -253,7 +253,7 @@ class ModuleManager
|
|||
|
||||
/**
|
||||
* Get all installed modules.
|
||||
*
|
||||
*
|
||||
* @param bool $useCache Use Cache
|
||||
*
|
||||
* @return array
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ use phpOMS\Utils\StringUtils;
|
|||
|
||||
/**
|
||||
* Package Manager model.
|
||||
*
|
||||
*
|
||||
* The package manager is responsible for handling installation and update packages for modules, frameworks and resources.
|
||||
*
|
||||
* @package Framework
|
||||
|
|
@ -67,13 +67,13 @@ class PackageManager
|
|||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
*
|
||||
* @param string $path Package source path e.g. path after download.
|
||||
* @param string $basePath Path of the application
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function __construct(string $path, string $basePath)
|
||||
public function __construct(string $path, string $basePath)
|
||||
{
|
||||
$this->path = $path;
|
||||
$this->basePath = $basePath;
|
||||
|
|
@ -81,11 +81,11 @@ class PackageManager
|
|||
|
||||
/**
|
||||
* Extract package to temporary destination
|
||||
*
|
||||
*
|
||||
* @param string $path Temporary extract path
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function extract(string $path) /* : void */
|
||||
|
|
@ -114,7 +114,7 @@ class PackageManager
|
|||
|
||||
/**
|
||||
* Validate package integrity
|
||||
*
|
||||
*
|
||||
* @return bool Returns true if the package is authentic, false otherwise
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -126,7 +126,7 @@ class PackageManager
|
|||
|
||||
/**
|
||||
* Hash array of files
|
||||
*
|
||||
*
|
||||
* @return string Hash value of files
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -138,7 +138,7 @@ class PackageManager
|
|||
|
||||
foreach ($files as $file) {
|
||||
if ($file === 'package.cert') {
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
|
||||
\sodium_crypto_generichash_update($state, file_get_contents($this->extractPath . '/package/' . $file));
|
||||
|
|
@ -149,7 +149,7 @@ class PackageManager
|
|||
|
||||
/**
|
||||
* Install package
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws \Exception
|
||||
|
|
@ -173,7 +173,7 @@ class PackageManager
|
|||
* Move files
|
||||
*
|
||||
* @param mixed $components Component data
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -189,7 +189,7 @@ class PackageManager
|
|||
* Copy files
|
||||
*
|
||||
* @param mixed $components Component data
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -209,7 +209,7 @@ class PackageManager
|
|||
* Delete files
|
||||
*
|
||||
* @param mixed $components Component data
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -225,12 +225,12 @@ class PackageManager
|
|||
* Execute commands
|
||||
*
|
||||
* @param mixed $components Component data
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function execute($components)
|
||||
private function execute($components)
|
||||
{
|
||||
foreach ($components as $component) {
|
||||
include $this->basePath . '/' . $component;
|
||||
|
|
@ -239,12 +239,12 @@ class PackageManager
|
|||
|
||||
/**
|
||||
* Cleanup after installation
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function cleanup()
|
||||
public function cleanup()
|
||||
{
|
||||
File::delete($this->path);
|
||||
Directory::delete($this->extractPath);
|
||||
|
|
@ -255,7 +255,7 @@ class PackageManager
|
|||
*
|
||||
* @param string $signedHash Hash to authenticate
|
||||
* @param string $rawHash Hash to compare against
|
||||
*
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
|
|||
|
|
@ -25,12 +25,12 @@ namespace phpOMS\Security;
|
|||
class PhpCode
|
||||
{
|
||||
public static $deprecatedFunctions = [
|
||||
'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',
|
||||
'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',
|
||||
'phpAds_xmlrpcEncode', 'popen', 'posix_getpwuid', 'posix_kill', 'posix_mkfifo', 'posix_setpgid', 'posix_setsid',
|
||||
'posix_setuid', 'posix_uname', 'proc_close', 'proc_get_status',
|
||||
'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',
|
||||
'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',
|
||||
'phpAds_xmlrpcEncode', 'popen', 'posix_getpwuid', 'posix_kill', 'posix_mkfifo', 'posix_setpgid', 'posix_setsid',
|
||||
'posix_setuid', 'posix_uname', 'proc_close', 'proc_get_status',
|
||||
];
|
||||
|
||||
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');
|
||||
}
|
||||
|
||||
public static function isDisabled(array $functions) : bool
|
||||
public static function isDisabled(array $functions) : bool
|
||||
{
|
||||
$disabled = ini_get('disable_functions');
|
||||
$disabled = str_replace(' ', '', $disabled);
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class SmartDateTime extends \DateTime
|
|||
{
|
||||
parent::__construct($time, $timezone);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create object from DateTime
|
||||
*
|
||||
|
|
@ -230,7 +230,7 @@ class SmartDateTime extends \DateTime
|
|||
{
|
||||
return (int) date('w', strtotime($d . '-' . $m . '-' . $y));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get day of week
|
||||
*
|
||||
|
|
@ -255,10 +255,10 @@ class SmartDateTime extends \DateTime
|
|||
public function getMonthCalendar(int $weekStartsWith = 0) : array
|
||||
{
|
||||
$days = [];
|
||||
|
||||
|
||||
// get day of first day in month
|
||||
$firstDay = $this->getFirstDayOfMonth();
|
||||
|
||||
|
||||
// calculate difference to $weekStartsWith
|
||||
$diffToWeekStart = Functions::mod($firstDay - $weekStartsWith, 7);
|
||||
$diffToWeekStart = $diffToWeekStart === 0 ? 7 : $diffToWeekStart;
|
||||
|
|
@ -266,18 +266,18 @@ class SmartDateTime extends \DateTime
|
|||
// get days of previous month
|
||||
$previousMonth = $this->createModify(0, -1);
|
||||
$daysPreviousMonth = $previousMonth->getDaysOfMonth();
|
||||
|
||||
|
||||
// add difference to $weekStartsWith counting backwards from days of previous month (reorder so that lowest value first)
|
||||
for ($i = $daysPreviousMonth - $diffToWeekStart; $i < $daysPreviousMonth; $i++) {
|
||||
$days[] = new \DateTime($previousMonth->format('Y') . '-' . $previousMonth->format('m') . '-' . ($i + 1));
|
||||
}
|
||||
|
||||
|
||||
// add normal count of current days
|
||||
$daysMonth = $this->getDaysOfMonth();
|
||||
for ($i = 1; $i <= $daysMonth; $i++) {
|
||||
$days[] = new \DateTime($this->format('Y') . '-' . $this->format('m') . '-' . ($i));
|
||||
}
|
||||
|
||||
|
||||
// add remaining days to next month (7*6 - difference+count of current month)
|
||||
$remainingDays = 42 - $diffToWeekStart - $daysMonth;
|
||||
$nextMonth = $this->createModify(0, 1);
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class BinaryTree extends Tree
|
|||
$list->setLeft($list->invert($list->nodes[1]));
|
||||
$list->setRight($list->invert($left));
|
||||
|
||||
return $list;
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -125,7 +125,7 @@ class BinaryTree extends Tree
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function inOrder(Node $node, \Closure $callback)
|
||||
public function inOrder(Node $node, \Closure $callback)
|
||||
{
|
||||
$this->inOrder($this->getLeft($node), $callback);
|
||||
$callback($node);
|
||||
|
|
@ -141,7 +141,7 @@ class BinaryTree extends Tree
|
|||
*
|
||||
* @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])) {
|
||||
$order[$horizontalDistance] = [];
|
||||
|
|
@ -190,7 +190,7 @@ class BinaryTree extends Tree
|
|||
*
|
||||
* @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)) {
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -30,14 +30,14 @@ class Edge
|
|||
|
||||
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->node2 = $node2;
|
||||
$this->directed = $directed;
|
||||
}
|
||||
|
||||
public function getNodes() : array
|
||||
public function getNodes() : array
|
||||
{
|
||||
return [$this->node1, $this->node2];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ class Tree extends Graph
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getMaxDepth(Node $node = null) : int
|
||||
public function getMaxDepth(Node $node = null) : int
|
||||
{
|
||||
$currentNode = $node ?? $this->root;
|
||||
|
||||
|
|
@ -146,7 +146,7 @@ class Tree extends Graph
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function isLeaf(Node $node) : bool
|
||||
public function isLeaf(Node $node) : bool
|
||||
{
|
||||
return count($this->getEdgesOfNode($node)) === 1;
|
||||
}
|
||||
|
|
@ -187,7 +187,7 @@ class Tree extends Graph
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function isFull(int $type) : bool
|
||||
public function isFull(int $type) : bool
|
||||
{
|
||||
if (count($this->edges) % $type !== 0) {
|
||||
return false;
|
||||
|
|
@ -225,7 +225,7 @@ class Tree extends Graph
|
|||
$this->preOrder($neighbor, $callback);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Perform action on tree in post-order.
|
||||
*
|
||||
|
|
@ -238,7 +238,7 @@ class Tree extends Graph
|
|||
if (count($this->nodes) === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$neighbors = $this->getNeighbors($node);
|
||||
|
||||
foreach ($neighbors as $neighbor) {
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ interface ContainerInterface
|
|||
*
|
||||
* @param string $path Path of the resource
|
||||
*
|
||||
* @return \DateTime
|
||||
* @return \DateTime
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
|
@ -42,7 +42,7 @@ interface ContainerInterface
|
|||
*
|
||||
* @param string $path Path of the resource
|
||||
*
|
||||
* @return \DateTime
|
||||
* @return \DateTime
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
|
@ -53,7 +53,7 @@ interface ContainerInterface
|
|||
*
|
||||
* @param string $path Path of the resource
|
||||
*
|
||||
* @return int
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
|
@ -77,7 +77,7 @@ interface ContainerInterface
|
|||
*
|
||||
* @param string $path Path of the resource
|
||||
*
|
||||
* @return string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
|
@ -191,7 +191,7 @@ interface ContainerInterface
|
|||
/**
|
||||
* 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
|
||||
*
|
||||
|
|
@ -235,7 +235,7 @@ interface ContainerInterface
|
|||
*
|
||||
* The parent resource path is always a directory.
|
||||
*
|
||||
* @return ContainerInterface
|
||||
* @return ContainerInterface
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
|
@ -286,7 +286,7 @@ interface ContainerInterface
|
|||
/**
|
||||
* Get the datetime when the resource got created.
|
||||
*
|
||||
* @return \DateTime
|
||||
* @return \DateTime
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
|
@ -295,7 +295,7 @@ interface ContainerInterface
|
|||
/**
|
||||
* Get the datetime when the resource got last modified.
|
||||
*
|
||||
* @return \DateTime
|
||||
* @return \DateTime
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
|
@ -304,7 +304,7 @@ interface ContainerInterface
|
|||
/**
|
||||
* Get the owner id of the resource.
|
||||
*
|
||||
* @return int
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ interface FileInterface extends ContainerInterface
|
|||
* @param string $content Content to save in file
|
||||
* @param int $mode Mode (overwrite, append)
|
||||
*
|
||||
* @return bool
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
|
@ -110,7 +110,7 @@ interface FileInterface extends ContainerInterface
|
|||
* @param string $content Content to save in file
|
||||
* @param int $mode Mode (overwrite, append)
|
||||
*
|
||||
* @return bool
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class FileUtils
|
|||
* @since 1.0.0
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
private function __construct()
|
||||
private function __construct()
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -102,7 +102,7 @@ class FileUtils
|
|||
if (empty($part) || $part === '.') {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if ($part !== '..') {
|
||||
$path[] = $part;
|
||||
} elseif (!empty($path)) {
|
||||
|
|
@ -111,7 +111,7 @@ class FileUtils
|
|||
throw new PathException($origPath);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $startsWithSlash . implode('/', $path);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -213,7 +213,7 @@ class File extends FileAbstract implements FileInterface
|
|||
$changed->setTimestamp(ftp_mdtm($con, $http->getPath()));
|
||||
|
||||
fclose($con);
|
||||
|
||||
|
||||
return $changed;
|
||||
}
|
||||
|
||||
|
|
@ -269,7 +269,7 @@ class File extends FileAbstract implements FileInterface
|
|||
$items = [];
|
||||
|
||||
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) {
|
||||
$chunks = preg_split("/\s+/", $fileData);
|
||||
|
||||
|
|
@ -281,17 +281,17 @@ class File extends FileAbstract implements FileInterface
|
|||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $items;
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the directory name of a file.
|
||||
*
|
||||
*
|
||||
* @param string $path Path of the file to get the directory name for.
|
||||
*
|
||||
*
|
||||
* @return string Returns the directory name of the file.
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -303,9 +303,9 @@ class File extends FileAbstract implements FileInterface
|
|||
|
||||
/**
|
||||
* Gets the directory path of a file.
|
||||
*
|
||||
*
|
||||
* @param string $path Path of the file to get the directory name for.
|
||||
*
|
||||
*
|
||||
* @return string Returns the directory name of the file.
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -324,7 +324,7 @@ class File extends FileAbstract implements FileInterface
|
|||
|
||||
if (($src = self::get($from)) === false) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return self::put($to, $src, $overwrite ? ContentPutMode::REPLACE : ContentPutMode::CREATE);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -237,9 +237,9 @@ class File extends FileAbstract implements FileInterface
|
|||
|
||||
/**
|
||||
* Gets the directory name of a file.
|
||||
*
|
||||
*
|
||||
* @param string $path Path of the file to get the directory name for.
|
||||
*
|
||||
*
|
||||
* @return string Returns the directory name of the file.
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -251,9 +251,9 @@ class File extends FileAbstract implements FileInterface
|
|||
|
||||
/**
|
||||
* Gets the directory path of a file.
|
||||
*
|
||||
*
|
||||
* @param string $path Path of the file to get the directory name for.
|
||||
*
|
||||
*
|
||||
* @return string Returns the directory name of the file.
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -319,7 +319,7 @@ class File extends FileAbstract implements FileInterface
|
|||
|
||||
/**
|
||||
* Gets the directory name of a file.
|
||||
*
|
||||
*
|
||||
* @return string Returns the directory name of the file.
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -331,7 +331,7 @@ class File extends FileAbstract implements FileInterface
|
|||
|
||||
/**
|
||||
* Gets the directory path of a file.
|
||||
*
|
||||
*
|
||||
* @return string Returns the directory path of the file.
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -362,7 +362,7 @@ class File extends FileAbstract implements FileInterface
|
|||
if (!is_writable(dirname($path))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
touch($path);
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ final class Storage
|
|||
* @since 1.0.0
|
||||
*/
|
||||
private static $registered = [];
|
||||
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
|
|
@ -42,7 +42,7 @@ final class Storage
|
|||
*/
|
||||
private function __construct()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ final class OperatingSystem
|
|||
return SystemType::WIN;
|
||||
} elseif (stristr(PHP_OS, 'LINUX') !== false) {
|
||||
return SystemType::LINUX;
|
||||
}
|
||||
}
|
||||
|
||||
return SystemType::UNKNOWN;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class SystemUtils
|
|||
if (stristr(PHP_OS, 'WIN')) {
|
||||
$mem = null;
|
||||
exec('wmic memorychip get capacity', $mem);
|
||||
|
||||
|
||||
/** @var array $mem */
|
||||
$mem = array_sum($mem) / 1024;
|
||||
} elseif (stristr(PHP_OS, 'LINUX')) {
|
||||
|
|
@ -63,7 +63,7 @@ class SystemUtils
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fclose($fh);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ final class UnhandledHandler
|
|||
|
||||
/**
|
||||
* Shutdown handler.
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ class Http implements UriInterface
|
|||
$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'] ?? '';
|
||||
|
||||
if (!empty($this->queryString)) {
|
||||
|
|
@ -246,7 +246,7 @@ class Http implements UriInterface
|
|||
{
|
||||
return $this->path;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get path offset.
|
||||
*
|
||||
|
|
@ -295,7 +295,7 @@ class Http implements UriInterface
|
|||
*/
|
||||
public function getPathElements() : array
|
||||
{
|
||||
return explode('/', $this->path);
|
||||
return explode('/', $this->path);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ class UriFactory
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function clearAll() : bool
|
||||
public static function clearAll() : bool
|
||||
{
|
||||
self::$uri = [];
|
||||
|
||||
|
|
@ -132,7 +132,7 @@ class UriFactory
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function clear(string $key) : bool
|
||||
public static function clear(string $key) : bool
|
||||
{
|
||||
if (isset(self::$uri[$key])) {
|
||||
unset(self::$uri[$key]);
|
||||
|
|
@ -152,7 +152,7 @@ class UriFactory
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function clearLike(string $pattern) : bool
|
||||
public static function clearLike(string $pattern) : bool
|
||||
{
|
||||
$success = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -229,7 +229,7 @@ abstract class C128Abstract
|
|||
* Save to file
|
||||
*
|
||||
* @param string $file File path/name
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -246,7 +246,7 @@ abstract class C128Abstract
|
|||
* Save to file
|
||||
*
|
||||
* @param string $file File path/name
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
|
|||
|
|
@ -102,12 +102,12 @@ class Currency
|
|||
|
||||
if (!isset($xml->Cube)) {
|
||||
throw new \Exception('Invalid xml path');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$node = $xml->Cube->Cube->Cube;
|
||||
self::$ecbCurrencies = [];
|
||||
|
||||
|
||||
foreach ($node as $key => $value) {
|
||||
self::$ecbCurrencies[strtoupper((string) $value->attributes()['currency'])] = (float) $value->attributes()['rate'];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -214,7 +214,7 @@ class Repository
|
|||
* Create repository
|
||||
*
|
||||
* @param string $source Create repository from source (optional, can be remote)
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @throws \Exception
|
||||
|
|
@ -292,7 +292,7 @@ class Repository
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function parseFileList($files) : string
|
||||
private function parseFileList($files) : string
|
||||
{
|
||||
if (is_array($files)) {
|
||||
return '"' . implode('" "', $files) . '"';
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ interface ArchiveInterface
|
|||
* @since 1.0.0
|
||||
*/
|
||||
public static function pack($sources, string $destination, bool $overwrite = true) : bool;
|
||||
|
||||
|
||||
/**
|
||||
* Unpack archive.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -33,21 +33,21 @@ class Gz implements ArchiveInterface
|
|||
if (!$overwrite && file_exists($destination)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (($gz = gzopen($destination, 'w')) === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$src = fopen($source, 'r');
|
||||
while (!feof($src)) {
|
||||
gzwrite($gz, fread($src, 4096));
|
||||
}
|
||||
|
||||
|
||||
fclose($src);
|
||||
|
||||
|
||||
return gzclose($gz);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
@ -57,18 +57,18 @@ class Gz implements ArchiveInterface
|
|||
if (file_exists($destination)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (($gz = gzopen($source, 'w')) === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$dest = fopen($destination, 'w');
|
||||
while (!gzeof($gz)) {
|
||||
fwrite($dest, gzread($gz, 4096));
|
||||
}
|
||||
|
||||
|
||||
fclose($dest);
|
||||
|
||||
|
||||
return gzclose($gz);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,6 +75,6 @@ class Tar implements ArchiveInterface
|
|||
*/
|
||||
public static function unpack(string $source, string $destination) : bool
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class TarGz implements ArchiveInterface
|
|||
|
||||
return $pack;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ class Zip implements ArchiveInterface
|
|||
|
||||
return $zip->close();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
@ -98,9 +98,9 @@ class Zip implements ArchiveInterface
|
|||
if (!$zip->open($source)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$zip->extractTo($destination . '/');
|
||||
|
||||
|
||||
return $zip->close();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,11 +113,11 @@ class Markdown
|
|||
];
|
||||
|
||||
protected static $safeLinksWhitelist = [
|
||||
'http://', 'https://', 'ftp://', 'ftps://', 'mailto:',
|
||||
'data:image/png;base64,', 'data:image/gif;base64,', 'data:image/jpeg;base64,',
|
||||
'http://', 'https://', 'ftp://', 'ftps://', 'mailto:',
|
||||
'data:image/png;base64,', 'data:image/gif;base64,', 'data:image/jpeg;base64,',
|
||||
'irc:', 'ircs:', 'git:', 'ssh:', 'news:', 'steam:',
|
||||
];
|
||||
|
||||
];
|
||||
|
||||
private static $definitionData = [];
|
||||
|
||||
public static function parse(string $text) : string
|
||||
|
|
@ -366,7 +366,7 @@ class Markdown
|
|||
}
|
||||
|
||||
$text = trim($lineArray['text'], '# ');
|
||||
|
||||
|
||||
return [
|
||||
'element' => [
|
||||
'name' => 'h' . min(6, $level),
|
||||
|
|
@ -534,7 +534,7 @@ class Markdown
|
|||
];
|
||||
|
||||
self::$definitionData['Reference'][$id] = $data;
|
||||
|
||||
|
||||
return ['hidden' => true];
|
||||
}
|
||||
|
||||
|
|
@ -744,7 +744,7 @@ class Markdown
|
|||
if (strpos($excerpt['text'], '>') === false || !preg_match('/^<((mailto:)?\S+?@\S+?)>/i', $excerpt['text'], $matches)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$url = $matches[1];
|
||||
|
||||
if (!isset($matches[2])) {
|
||||
|
|
@ -1066,7 +1066,7 @@ class Markdown
|
|||
|
||||
return $element;
|
||||
}
|
||||
|
||||
|
||||
protected static function escape(string $text, bool $allowQuotes = false) : string
|
||||
{
|
||||
return htmlspecialchars($text, $allowQuotes ? ENT_NOQUOTES : ENT_QUOTES, 'UTF-8');
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class Permutation
|
|||
$newres[] = $val;
|
||||
|
||||
unset($newArr[$key]);
|
||||
|
||||
|
||||
$permutations = array_merge($permutations, self::permut($newArr, $newres));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class DateTime
|
|||
public static function generateDateTime(\DateTime $start, \DateTime $end) : \DateTime
|
||||
{
|
||||
$rng = new \DateTime();
|
||||
|
||||
|
||||
return $rng->setTimestamp(mt_rand($start->getTimestamp(), $end->getTimestamp()));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,16 +32,16 @@ class File
|
|||
* @since 1.0.0
|
||||
*/
|
||||
private static $extensions = [
|
||||
['exe', null], ['dat', null], ['txt', null], ['csv', 'txt'], ['doc', null], ['docx', 'doc'],
|
||||
['mp3', null], ['mp4', null], ['avi', null], ['mpeg', null], ['wmv', null], ['ppt', 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],
|
||||
['jpg', null], ['png', null], ['gif', null], ['bmp', null], ['ttf', null], ['zip', 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],
|
||||
['pptx', 'ppt'], ['xml', null], ['dll', null], ['wav', null], ['wma', null], ['vb', 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],
|
||||
['exe', null], ['dat', null], ['txt', null], ['csv', 'txt'], ['doc', null], ['docx', 'doc'],
|
||||
['mp3', null], ['mp4', null], ['avi', null], ['mpeg', null], ['wmv', null], ['ppt', 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],
|
||||
['jpg', null], ['png', null], ['gif', null], ['bmp', null], ['ttf', null], ['zip', 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],
|
||||
['pptx', 'ppt'], ['xml', null], ['dll', null], ['wav', null], ['wma', null], ['vb', 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],
|
||||
['flv', null], ['fla', null], ['deb', null], ['py', null], ['pl', null],
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -470,11 +470,11 @@ class Name
|
|||
'male' => ['none'],
|
||||
'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',
|
||||
],
|
||||
]
|
||||
];
|
||||
|
|
|
|||
|
|
@ -32,21 +32,21 @@ class Text
|
|||
* @since 1.0.0
|
||||
*/
|
||||
private static $words_west = [
|
||||
'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',
|
||||
'pretium', 'quis', 'congue', 'praesent', 'sagittis', 'laoreet', 'auctor', 'mauris', 'non', 'velit', 'eros', 'dictum',
|
||||
'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',
|
||||
'condimentum', 'enim', 'sodales', 'in', 'hac', 'habitasse', 'platea', 'dictumst', 'aenean', 'neque', 'fusce', 'augue',
|
||||
'leo', 'eget', 'semper', 'mattis', 'tortor', 'scelerisque', 'nulla', 'interdum', 'tellus', 'malesuada', 'rhoncus', 'porta',
|
||||
'sem', 'aliquet', 'et', 'nam', 'suspendisse', 'potenti', 'vivamus', 'luctus', 'fringilla', 'erat', 'donec', 'justo',
|
||||
'vehicula', 'ultricies', 'varius', 'ante', 'primis', 'faucibus', 'ultrices', 'posuere', 'cubilia', 'curae', 'etiam',
|
||||
'cursus', 'aliquam', 'quam', 'dapibus', 'nisl', 'feugiat', 'egestas', 'class', 'aptent', 'taciti', 'sociosqu', 'ad',
|
||||
'litora', 'torquent', 'per', 'conubia', 'nostra', 'inceptos', 'himenaeos', 'phasellus', 'nibh', 'pulvinar', 'vitae',
|
||||
'urna', 'iaculis', 'lobortis', 'nisi', 'viverra', 'arcu', 'morbi', 'pellentesque', 'metus', 'commodo', 'ut', 'facilisis',
|
||||
'felis', 'tristique', 'ullamcorper', 'placerat', 'aenean', 'convallis', 'sollicitudin', 'integer', 'rutrum', 'duis', 'est',
|
||||
'etiam', 'bibendum', 'donec', 'pharetra', 'vulputate', 'maecenas', 'mi', 'fermentum', 'consequat', 'suscipit', 'aliquam',
|
||||
'habitant', 'senectus', 'netus', 'fames', 'quisque', 'euismod', 'curabitur', 'lectus', 'elementum', 'tempor', 'risus',
|
||||
'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',
|
||||
'pretium', 'quis', 'congue', 'praesent', 'sagittis', 'laoreet', 'auctor', 'mauris', 'non', 'velit', 'eros', 'dictum',
|
||||
'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',
|
||||
'condimentum', 'enim', 'sodales', 'in', 'hac', 'habitasse', 'platea', 'dictumst', 'aenean', 'neque', 'fusce', 'augue',
|
||||
'leo', 'eget', 'semper', 'mattis', 'tortor', 'scelerisque', 'nulla', 'interdum', 'tellus', 'malesuada', 'rhoncus', 'porta',
|
||||
'sem', 'aliquet', 'et', 'nam', 'suspendisse', 'potenti', 'vivamus', 'luctus', 'fringilla', 'erat', 'donec', 'justo',
|
||||
'vehicula', 'ultricies', 'varius', 'ante', 'primis', 'faucibus', 'ultrices', 'posuere', 'cubilia', 'curae', 'etiam',
|
||||
'cursus', 'aliquam', 'quam', 'dapibus', 'nisl', 'feugiat', 'egestas', 'class', 'aptent', 'taciti', 'sociosqu', 'ad',
|
||||
'litora', 'torquent', 'per', 'conubia', 'nostra', 'inceptos', 'himenaeos', 'phasellus', 'nibh', 'pulvinar', 'vitae',
|
||||
'urna', 'iaculis', 'lobortis', 'nisi', 'viverra', 'arcu', 'morbi', 'pellentesque', 'metus', 'commodo', 'ut', 'facilisis',
|
||||
'felis', 'tristique', 'ullamcorper', 'placerat', 'aenean', 'convallis', 'sollicitudin', 'integer', 'rutrum', 'duis', 'est',
|
||||
'etiam', 'bibendum', 'donec', 'pharetra', 'vulputate', 'maecenas', 'mi', 'fermentum', 'consequat', 'suscipit', 'aliquam',
|
||||
'habitant', 'senectus', 'netus', 'fames', 'quisque', 'euismod', 'curabitur', 'lectus', 'elementum', 'tempor', 'risus',
|
||||
'cras',
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class StringCompare
|
|||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
*
|
||||
* @param array $dictionary Dictionary
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -48,9 +48,9 @@ class StringCompare
|
|||
|
||||
/**
|
||||
* Adds word to dictionary
|
||||
*
|
||||
*
|
||||
* @param string $word Word to add to dictionary
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -177,5 +177,5 @@ class StringCompare
|
|||
return min($phraseValue * $phraseWeight, $wordValue * $wordWeight) * $minWeight
|
||||
+ max($phraseValue * $phraseWeight, $wordValue * $wordWeight) * $maxWeight
|
||||
+ $lengthValue * $lengthWeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -350,7 +350,7 @@ class StringUtils
|
|||
*
|
||||
* @param string $value String to analyze.
|
||||
*
|
||||
* @return float
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
|
@ -373,7 +373,7 @@ class StringUtils
|
|||
*
|
||||
* @param string $input String to count chars.
|
||||
*
|
||||
* @return array
|
||||
* @return array
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ class Cron extends SchedulerAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function normalize(string $raw) : string
|
||||
private function normalize(string $raw) : string
|
||||
{
|
||||
return str_replace("\r\n", "\n", $raw);
|
||||
}
|
||||
|
|
@ -92,7 +92,7 @@ class Cron extends SchedulerAbstract
|
|||
$jobs[] = CronJob::createWith(str_getcsv($line, ' '));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $jobs;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,14 +36,14 @@ class Schedule extends TaskAbstract
|
|||
$job->setRun($jobData[8]);
|
||||
$job->setStatus($jobData[3]);
|
||||
|
||||
if (DateTime::isValid($jobData[2])) {
|
||||
if (DateTime::isValid($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->setComment($jobData[10]);
|
||||
$job->addResult($jobData[6]);
|
||||
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ abstract class SchedulerAbstract
|
|||
|
||||
/**
|
||||
* Create task
|
||||
*
|
||||
*
|
||||
* @param TaskAbstract
|
||||
*
|
||||
* @return void
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ abstract class TaskAbstract
|
|||
|
||||
/**
|
||||
* Comment
|
||||
*
|
||||
*
|
||||
* @param string $name Name of the task
|
||||
* @param string $cmd Command/script to run
|
||||
*
|
||||
|
|
@ -85,7 +85,7 @@ abstract class TaskAbstract
|
|||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
*
|
||||
* @param string $name Id/name of the task (on linux the same as the executable script)
|
||||
* @param string $cmd Command to create the task
|
||||
*
|
||||
|
|
@ -222,7 +222,7 @@ abstract class TaskAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getLastRuntime()
|
||||
public function getLastRuntime()
|
||||
{
|
||||
return $this->lastRunTime;
|
||||
}
|
||||
|
|
@ -269,11 +269,11 @@ abstract class TaskAbstract
|
|||
|
||||
/**
|
||||
* Create task based on job data
|
||||
*
|
||||
*
|
||||
* @param array $jobData Raw job data
|
||||
*
|
||||
*
|
||||
* @return TaskAbstract
|
||||
*
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
abstract public static function createWith(array $jobData) : TaskAbstract;
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ class TaskScheduler extends SchedulerAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function normalize(string $raw) : string
|
||||
private function normalize(string $raw) : string
|
||||
{
|
||||
return str_replace("\r\n", "\n", $raw);
|
||||
}
|
||||
|
|
@ -89,7 +89,7 @@ class TaskScheduler extends SchedulerAbstract
|
|||
foreach ($lines as $line) {
|
||||
$jobs[] = Schedule::createWith(str_getcsv($line));
|
||||
}
|
||||
|
||||
|
||||
return $jobs;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,26 +38,26 @@ class TestUtils
|
|||
public static function setMember(/* object */ $obj, string $name, $value) : bool
|
||||
{
|
||||
$reflectionClass = new \ReflectionClass(is_string($obj) ? $obj : get_class($obj));
|
||||
|
||||
|
||||
if (!$reflectionClass->hasProperty($name)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$reflectionProperty = $reflectionClass->getProperty($name);
|
||||
|
||||
|
||||
if (!($accessible = $reflectionProperty->isPublic())) {
|
||||
$reflectionProperty->setAccessible(true);
|
||||
}
|
||||
|
||||
|
||||
$reflectionProperty->setValue($obj, $value);
|
||||
|
||||
|
||||
if (!$accessible) {
|
||||
$reflectionProperty->setAccessible(false);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get private object member
|
||||
*
|
||||
|
|
@ -68,26 +68,26 @@ class TestUtils
|
|||
*
|
||||
* @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));
|
||||
|
||||
|
||||
if (!$reflectionClass->hasProperty($name)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
$reflectionProperty = $reflectionClass->getProperty($name);
|
||||
|
||||
|
||||
if (!($accessible = $reflectionProperty->isPublic())) {
|
||||
$reflectionProperty->setAccessible(true);
|
||||
}
|
||||
|
||||
|
||||
$value = $reflectionProperty->getValue($obj);
|
||||
|
||||
|
||||
if (!$accessible) {
|
||||
$reflectionProperty->setAccessible(false);
|
||||
}
|
||||
|
||||
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,6 @@ class Barcode extends ValidatorAbstract
|
|||
{
|
||||
public static function isValid($value, array $constraints = null)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -20,6 +20,6 @@ class Barcode11 extends ValidatorAbstract
|
|||
{
|
||||
public static function isValid($value, array $constraints = null)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -20,6 +20,6 @@ class Barcode128 extends ValidatorAbstract
|
|||
{
|
||||
public static function isValid($value, array $constraints = null)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -20,6 +20,6 @@ class Barcode25 extends ValidatorAbstract
|
|||
{
|
||||
public static function isValid($value, array $constraints = null)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -20,6 +20,6 @@ class Barcode39 extends ValidatorAbstract
|
|||
{
|
||||
public static function isValid($value, array $constraints = null)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -20,6 +20,6 @@ class Barcode93 extends ValidatorAbstract
|
|||
{
|
||||
public static function isValid($value, array $constraints = null)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -20,6 +20,6 @@ class BarcodeCodebar extends ValidatorAbstract
|
|||
{
|
||||
public static function isValid($value, array $constraints = null)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -20,6 +20,6 @@ class BarcodeDatamatrix extends ValidatorAbstract
|
|||
{
|
||||
public static function isValid($value, array $constraints = null)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -20,6 +20,6 @@ class BarcodeEAN extends ValidatorAbstract
|
|||
{
|
||||
public static function isValid($value, array $constraints = null)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -20,6 +20,6 @@ class BarcodeMSI extends ValidatorAbstract
|
|||
{
|
||||
public static function isValid($value, array $constraints = null)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -20,6 +20,6 @@ class QrCode extends ValidatorAbstract
|
|||
{
|
||||
public static function isValid($value, array $constraints = null)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -158,7 +158,7 @@ class View extends ViewAbstract
|
|||
* @param string $translation Text
|
||||
* @param string $module Module name
|
||||
* @param string $theme Theme name
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @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 $module Module name
|
||||
* @param string $theme Theme name
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ abstract class ViewAbstract implements \Serializable
|
|||
*
|
||||
* @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])) {
|
||||
$this->views[$id] = $view;
|
||||
|
|
@ -163,10 +163,10 @@ abstract class ViewAbstract implements \Serializable
|
|||
if ($order !== 0) {
|
||||
uasort($this->views, ['\phpOMS\Views\View', 'viewSort']);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -59,6 +59,6 @@ class AccountManagerTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertTrue($manager->remove($account->getId()));
|
||||
self::assertFalse($manager->remove(-1));
|
||||
self::assertEquals(0, $manager->count());
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class PermissionTypeTest extends \PHPUnit\Framework\TestCase
|
|||
{
|
||||
self::assertEquals(6, count(PermissionType::getConstants()));
|
||||
self::assertEquals(PermissionType::getConstants(), array_unique(PermissionType::getConstants()));
|
||||
|
||||
|
||||
self::assertEquals(1, PermissionType::NONE);
|
||||
self::assertEquals(2, PermissionType::READ);
|
||||
self::assertEquals(4, PermissionType::CREATE);
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class ApplicationAbstractTest extends \PHPUnit\Framework\TestCase
|
|||
public function testGetSet()
|
||||
{
|
||||
$obj = new class extends ApplicationAbstract {};
|
||||
|
||||
|
||||
$obj->appName = 'Test';
|
||||
self::assertEquals('Test', $obj->appName);
|
||||
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@ use phpOMS\DataStorage\Database\DatabasePool;
|
|||
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
||||
|
||||
// Reset database
|
||||
$db = new \PDO($CONFIG['db']['core']['masters']['admin']['db'] . ':host=' .
|
||||
$CONFIG['db']['core']['masters']['admin']['host'],
|
||||
$CONFIG['db']['core']['masters']['admin']['login'],
|
||||
$db = new \PDO($CONFIG['db']['core']['masters']['admin']['db'] . ':host=' .
|
||||
$CONFIG['db']['core']['masters']['admin']['host'],
|
||||
$CONFIG['db']['core']['masters']['admin']['login'],
|
||||
$CONFIG['db']['core']['masters']['admin']['password']
|
||||
);
|
||||
$db->exec('DROP DATABASE IF EXISTS ' . $CONFIG['db']['core']['masters']['admin']['database']);
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
namespace phpOMS\tests\Business\Finance;
|
||||
|
||||
|
||||
use phpOMS\Business\Finance\Depreciation;
|
||||
|
||||
class DepreciationTest extends \PHPUnit\Framework\TestCase
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ namespace phpOMS\tests\Business\Finance;
|
|||
|
||||
use phpOMS\Business\Finance\FinanceFormulas;
|
||||
|
||||
|
||||
class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
public function testAnnualPercentageYield()
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
namespace phpOMS\tests\Business\Finance\Forecasting;
|
||||
|
||||
|
||||
use phpOMS\Business\Finance\Forecasting\ARCH;
|
||||
|
||||
class ARCHTest extends \PHPUnit\Framework\TestCase
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
namespace phpOMS\tests\Business\Finance\Forecasting;
|
||||
|
||||
|
||||
use phpOMS\Business\Finance\Forecasting\ARFIMA;
|
||||
|
||||
class ARFIMATest extends \PHPUnit\Framework\TestCase
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
namespace phpOMS\tests\Business\Finance\Forecasting;
|
||||
|
||||
|
||||
use phpOMS\Business\Finance\Forecasting\ARIMA;
|
||||
|
||||
class ARIMATest extends \PHPUnit\Framework\TestCase
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
namespace phpOMS\tests\Business\Finance\Forecasting;
|
||||
|
||||
|
||||
use phpOMS\Business\Finance\Forecasting\ARMA;
|
||||
|
||||
class ARMATest extends \PHPUnit\Framework\TestCase
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
namespace phpOMS\tests\Business\Finance\Forecasting;
|
||||
|
||||
|
||||
use phpOMS\Business\Finance\Forecasting\AR;
|
||||
|
||||
class ARTest extends \PHPUnit\Framework\TestCase
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user