mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-13 07:18:39 +00:00
automated rector fixes
This commit is contained in:
parent
7bf216708b
commit
af38754915
|
|
@ -114,7 +114,9 @@ final class Weighted
|
||||||
return $jobs;
|
return $jobs;
|
||||||
}
|
}
|
||||||
|
|
||||||
\usort($jobs, [self::class, 'sortByEnd']);
|
\usort($jobs, function (\phpOMS\Algorithm\JobScheduling\JobInterface $j1, \phpOMS\Algorithm\JobScheduling\JobInterface $j2) : int {
|
||||||
|
return self::sortByEnd($j1, $j2);
|
||||||
|
});
|
||||||
|
|
||||||
$valueTable = [$jobs[0]->getValue()];
|
$valueTable = [$jobs[0]->getValue()];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@ final class Glicko2
|
||||||
$tau = $this->tau;
|
$tau = $this->tau;
|
||||||
|
|
||||||
// Step 0:
|
// Step 0:
|
||||||
$rdOld = $rdOld / self::Q;
|
$rdOld /= self::Q;
|
||||||
$elo = ($elo - $this->DEFAULT_ELO) / self::Q;
|
$elo = ($elo - $this->DEFAULT_ELO) / self::Q;
|
||||||
|
|
||||||
foreach ($oElo as $idx => $value) {
|
foreach ($oElo as $idx => $value) {
|
||||||
|
|
|
||||||
|
|
@ -207,8 +207,7 @@ final class MemoryCF
|
||||||
}
|
}
|
||||||
|
|
||||||
\asort($matches);
|
\asort($matches);
|
||||||
$matches = \array_reverse($matches, true);
|
|
||||||
|
|
||||||
return $matches;
|
return \array_reverse($matches, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -193,7 +193,7 @@ abstract class ConnectionAbstract implements ConnectionInterface
|
||||||
*/
|
*/
|
||||||
public function isInitialized() : bool
|
public function isInitialized() : bool
|
||||||
{
|
{
|
||||||
return isset($this->con) && !($this->con instanceof NullPDO);
|
return $this->con !== null && !($this->con instanceof NullPDO);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -207,7 +207,7 @@ abstract class ConnectionAbstract implements ConnectionInterface
|
||||||
*/
|
*/
|
||||||
public function __get(string $name) : mixed
|
public function __get(string $name) : mixed
|
||||||
{
|
{
|
||||||
if ($name === 'con' && !isset($this->con)) {
|
if ($name === 'con' && $this->con === null) {
|
||||||
$this->connect($this->dbdata);
|
$this->connect($this->dbdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -171,11 +171,7 @@ final class DeleteMapper extends DataMapperAbstract
|
||||||
|
|
||||||
$objIds = [];
|
$objIds = [];
|
||||||
$refProp = $refClass->getProperty($member);
|
$refProp = $refClass->getProperty($member);
|
||||||
if (!$refProp->isPublic()) {
|
$values = $refProp->isPublic() ? $obj->{$member} : $refProp->getValue($obj);
|
||||||
$values = $refProp->getValue($obj);
|
|
||||||
} else {
|
|
||||||
$values = $obj->{$member};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!\is_array($values)) {
|
if (!\is_array($values)) {
|
||||||
// conditionals
|
// conditionals
|
||||||
|
|
|
||||||
|
|
@ -263,7 +263,7 @@ final class ReadMapper extends DataMapperAbstract
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
return !\is_array($result) ? [$result] : $result;
|
return \is_array($result) ? $result : [$result];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -315,10 +315,8 @@ final class ReadMapper extends DataMapperAbstract
|
||||||
foreach ($columns as $key => $values) {
|
foreach ($columns as $key => $values) {
|
||||||
if (\is_string($values)) {
|
if (\is_string($values)) {
|
||||||
$query->selectAs($key, $values);
|
$query->selectAs($key, $values);
|
||||||
} else {
|
} elseif (($values['writeonly'] ?? false) === false || isset($this->with[$values['internal']])) {
|
||||||
if (($values['writeonly'] ?? false) === false || isset($this->with[$values['internal']])) {
|
$query->selectAs($this->mapper::TABLE . '_d' . $this->depth . '.' . $key, $key . '_d' . $this->depth);
|
||||||
$query->selectAs($this->mapper::TABLE . '_d' . $this->depth . '.' . $key, $key . '_d' . $this->depth);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -118,8 +118,8 @@ final class UpdateMapper extends DataMapperAbstract
|
||||||
$propertyName = \stripos($column['internal'], '/') !== false ? \explode('/', $column['internal'])[0] : $column['internal'];
|
$propertyName = \stripos($column['internal'], '/') !== false ? \explode('/', $column['internal'])[0] : $column['internal'];
|
||||||
if (isset($this->mapper::HAS_MANY[$propertyName])
|
if (isset($this->mapper::HAS_MANY[$propertyName])
|
||||||
|| $column['internal'] === $this->mapper::PRIMARYFIELD
|
|| $column['internal'] === $this->mapper::PRIMARYFIELD
|
||||||
|| (($column['readonly'] ?? false) === true && !isset($this->with[$propertyName]))
|
|| (($column['readonly'] ?? false) && !isset($this->with[$propertyName]))
|
||||||
|| (($column['writeonly'] ?? false) === true && !isset($this->with[$propertyName]))
|
|| (($column['writeonly'] ?? false) && !isset($this->with[$propertyName]))
|
||||||
) {
|
) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -127,11 +127,7 @@ final class UpdateMapper extends DataMapperAbstract
|
||||||
$refClass = $refClass ?? new \ReflectionClass($obj);
|
$refClass = $refClass ?? new \ReflectionClass($obj);
|
||||||
$property = $refClass->getProperty($propertyName);
|
$property = $refClass->getProperty($propertyName);
|
||||||
|
|
||||||
if (!($property->isPublic())) {
|
$tValue = $property->isPublic() ? $obj->{$propertyName} : $property->getValue($obj);
|
||||||
$tValue = $property->getValue($obj);
|
|
||||||
} else {
|
|
||||||
$tValue = $obj->{$propertyName};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($this->mapper::OWNS_ONE[$propertyName])) {
|
if (isset($this->mapper::OWNS_ONE[$propertyName])) {
|
||||||
$id = \is_object($tValue) ? $this->updateOwnsOne($propertyName, $tValue) : $tValue;
|
$id = \is_object($tValue) ? $this->updateOwnsOne($propertyName, $tValue) : $tValue;
|
||||||
|
|
@ -246,11 +242,7 @@ final class UpdateMapper extends DataMapperAbstract
|
||||||
|
|
||||||
$property = $refClass->getProperty($propertyName);
|
$property = $refClass->getProperty($propertyName);
|
||||||
|
|
||||||
if (!($isPublic = $property->isPublic())) {
|
$values = ($isPublic = $property->isPublic()) ? $obj->{$propertyName} : $property->getValue($obj);
|
||||||
$values = $property->getValue($obj);
|
|
||||||
} else {
|
|
||||||
$values = $obj->{$propertyName};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!\is_array($values) || empty($values)) {
|
if (!\is_array($values) || empty($values)) {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
|
|
@ -230,11 +230,7 @@ final class WriteMapper extends DataMapperAbstract
|
||||||
$refClass = new \ReflectionClass($obj);
|
$refClass = new \ReflectionClass($obj);
|
||||||
$refProp = $refClass->getProperty($this->mapper::BELONGS_TO[$propertyName]['by']);
|
$refProp = $refClass->getProperty($this->mapper::BELONGS_TO[$propertyName]['by']);
|
||||||
|
|
||||||
if (!$refProp->isPublic()) {
|
$obj = $refProp->isPublic() ? $obj->{$this->mapper::BELONGS_TO[$propertyName]['by']} : $refProp->getValue($obj);
|
||||||
$obj = $refProp->getValue($obj);
|
|
||||||
} else {
|
|
||||||
$obj = $obj->{$this->mapper::BELONGS_TO[$propertyName]['by']};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @var class-string<DataMapperFactory> $mapper */
|
/** @var class-string<DataMapperFactory> $mapper */
|
||||||
|
|
@ -266,11 +262,7 @@ final class WriteMapper extends DataMapperAbstract
|
||||||
}
|
}
|
||||||
|
|
||||||
$property = $refClass->getProperty($propertyName);
|
$property = $refClass->getProperty($propertyName);
|
||||||
if (!$property->isPublic()) {
|
$values = $property->isPublic() ? $obj->{$propertyName} : $property->getValue($obj);
|
||||||
$values = $property->getValue($obj);
|
|
||||||
} else {
|
|
||||||
$values = $obj->{$propertyName};
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @var class-string<DataMapperFactory> $mapper */
|
/** @var class-string<DataMapperFactory> $mapper */
|
||||||
$mapper = $this->mapper::HAS_MANY[$propertyName]['mapper'];
|
$mapper = $this->mapper::HAS_MANY[$propertyName]['mapper'];
|
||||||
|
|
@ -301,7 +293,7 @@ final class WriteMapper extends DataMapperAbstract
|
||||||
}
|
}
|
||||||
|
|
||||||
$objsIds = [];
|
$objsIds = [];
|
||||||
$relReflectionClass = !empty($values) ? new \ReflectionClass(\reset($values)) : null;
|
$relReflectionClass = empty($values) ? null : new \ReflectionClass(\reset($values));
|
||||||
|
|
||||||
foreach ($values as $key => $value) {
|
foreach ($values as $key => $value) {
|
||||||
if (!\is_object($value)) {
|
if (!\is_object($value)) {
|
||||||
|
|
@ -328,19 +320,16 @@ final class WriteMapper extends DataMapperAbstract
|
||||||
|
|
||||||
// todo maybe consider to just set the column type to object, and then check for that (might be faster)
|
// todo maybe consider to just set the column type to object, and then check for that (might be faster)
|
||||||
if (isset($mapper::BELONGS_TO[$internalName])
|
if (isset($mapper::BELONGS_TO[$internalName])
|
||||||
|| isset($mapper::OWNS_ONE[$internalName])
|
|| isset($mapper::OWNS_ONE[$internalName])) {
|
||||||
) {
|
|
||||||
if (!$isRelPublic) {
|
if (!$isRelPublic) {
|
||||||
$relProperty->setValue($value, $this->mapper::createNullModel($objId));
|
$relProperty->setValue($value, $this->mapper::createNullModel($objId));
|
||||||
} else {
|
} else {
|
||||||
$value->{$internalName} = $this->mapper::createNullModel($objId);
|
$value->{$internalName} = $this->mapper::createNullModel($objId);
|
||||||
}
|
}
|
||||||
|
} elseif (!$isRelPublic) {
|
||||||
|
$relProperty->setValue($value, $objId);
|
||||||
} else {
|
} else {
|
||||||
if (!$isRelPublic) {
|
$value->{$internalName} = $objId;
|
||||||
$relProperty->setValue($value, $objId);
|
|
||||||
} else {
|
|
||||||
$value->{$internalName} = $objId;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$isRelPublic) {
|
if (!$isRelPublic) {
|
||||||
|
|
|
||||||
|
|
@ -83,11 +83,11 @@ class Grammar extends GrammarAbstract
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($query->unions)) {
|
if (!empty($query->unions)) {
|
||||||
$sql[] = $this->compileUnions($query, $query->unions);
|
$sql[] = $this->compileUnions();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($query->lock)) {
|
if (!empty($query->lock)) {
|
||||||
$sql[] = $this->compileLock($query, $query->lock);
|
$sql[] = $this->compileLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
@ -399,9 +399,7 @@ class Grammar extends GrammarAbstract
|
||||||
$expression .= $this->compileOn($query, $query->ons[$join['alias'] ?? $table]) . ' ';
|
$expression .= $this->compileOn($query, $query->ons[$join['alias'] ?? $table]) . ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
$expression = \rtrim($expression, ', ');
|
return \rtrim($expression, ', ');
|
||||||
|
|
||||||
return $expression;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -49,10 +49,7 @@ final class JWT
|
||||||
$payload64 = Base64Url::encode(\json_encode($payload));
|
$payload64 = Base64Url::encode(\json_encode($payload));
|
||||||
|
|
||||||
$algorithm = '';
|
$algorithm = '';
|
||||||
switch (\strtolower($header['alg'])) {
|
$algorithm = 'sha256';
|
||||||
default:
|
|
||||||
$algorithm = 'sha256';
|
|
||||||
}
|
|
||||||
|
|
||||||
return \hash_hmac($algorithm, $header64 . '.' . $payload64, $secret, false);
|
return \hash_hmac($algorithm, $header64 . '.' . $payload64, $secret, false);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -848,11 +848,7 @@ class Matrix implements \ArrayAccess, \Iterator
|
||||||
for ($i = 0; $i < $this->m; ++$i) {
|
for ($i = 0; $i < $this->m; ++$i) {
|
||||||
$row = [];
|
$row = [];
|
||||||
for ($j = 0; $j < $this->m; ++$j) {
|
for ($j = 0; $j < $this->m; ++$j) {
|
||||||
if ($i === $j) {
|
$row[] = $i === $j ? \pow($this->matrix[$i][$j], $exponent) : 0;
|
||||||
$row[] = \pow($this->matrix[$i][$j], $exponent);
|
|
||||||
} else {
|
|
||||||
$row[] = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$matrix[] = $row;
|
$matrix[] = $row;
|
||||||
|
|
|
||||||
|
|
@ -153,10 +153,7 @@ final class CliHeader extends HeaderAbstract
|
||||||
*/
|
*/
|
||||||
public function generate(int $code) : void
|
public function generate(int $code) : void
|
||||||
{
|
{
|
||||||
switch ($code) {
|
$this->generate500();
|
||||||
default:
|
|
||||||
$this->generate500();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getRequestTime() : int
|
public function getRequestTime() : int
|
||||||
|
|
|
||||||
|
|
@ -160,7 +160,7 @@ final class HttpHeader extends HeaderAbstract
|
||||||
return $_SERVER['HTTP_X_FORWARDED_FOR'] ?? $_SERVER['REMOTE_ADDR'] ?? '';
|
return $_SERVER['HTTP_X_FORWARDED_FOR'] ?? $_SERVER['REMOTE_ADDR'] ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getBrowserName() {
|
public function getBrowserName(): string {
|
||||||
$userAgent = $_SERVER['HTTP_USER_AGENT'];
|
$userAgent = $_SERVER['HTTP_USER_AGENT'];
|
||||||
|
|
||||||
if (\strpos($userAgent, 'Opera') !== false || \strpos($userAgent, 'OPR/') !== false) {
|
if (\strpos($userAgent, 'Opera') !== false || \strpos($userAgent, 'OPR/') !== false) {
|
||||||
|
|
|
||||||
|
|
@ -80,9 +80,14 @@ final class FormElementGenerator
|
||||||
|
|
||||||
$element .= ($json['subtype'] === 'checkbox' || $json['subtype'] === 'radio') && $json['default']['checked'] ? ' checked' : '';
|
$element .= ($json['subtype'] === 'checkbox' || $json['subtype'] === 'radio') && $json['default']['checked'] ? ' checked' : '';
|
||||||
$element .= '>';
|
$element .= '>';
|
||||||
$element .= $json['subtype'] === 'checkbox' || $json['subtype'] === 'radio' ? '<label for="' . $json['attributes']['id'] . '">' . ($lang[$json['default']['content']] ?? $json['default']['content']) . '</label>' : '';
|
|
||||||
|
|
||||||
return $element;
|
return $element
|
||||||
|
. ($json['subtype'] === 'checkbox' || $json['subtype'] === 'radio'
|
||||||
|
? '<label for="' . $json['attributes']['id'] . '">'
|
||||||
|
. ($lang[$json['default']['content']] ?? $json['default']['content'])
|
||||||
|
. '</label>'
|
||||||
|
: ''
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -108,12 +113,12 @@ final class FormElementGenerator
|
||||||
$value ??= $json['default']['value'];
|
$value ??= $json['default']['value'];
|
||||||
|
|
||||||
foreach ($json['options'] as $val => $text) {
|
foreach ($json['options'] as $val => $text) {
|
||||||
$element .= '<option value="' . $val . '"' . (isset($json['default']) && $val === $value ? ' selected' : '') . '>' . ($lang[$text] ?? $text) . '</option>';
|
$element .= '<option value="' . $val . '"' . (isset($json['default']) && $val === $value ? ' selected' : '') . '>'
|
||||||
|
. ($lang[$text] ?? $text)
|
||||||
|
. '</option>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$element .= '</select>';
|
return $element . '</select>';
|
||||||
|
|
||||||
return $element;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -137,9 +142,8 @@ final class FormElementGenerator
|
||||||
|
|
||||||
$element .= '>';
|
$element .= '>';
|
||||||
$element .= isset($json['default']) ? $value : '';
|
$element .= isset($json['default']) ? $value : '';
|
||||||
$element .= '</textarea>';
|
|
||||||
|
|
||||||
return $element;
|
return $element . '</textarea>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -161,8 +165,7 @@ final class FormElementGenerator
|
||||||
|
|
||||||
$element .= '>';
|
$element .= '>';
|
||||||
$element .= $lang[$json['default']['value']] ?? $json['default']['value'];
|
$element .= $lang[$json['default']['value']] ?? $json['default']['value'];
|
||||||
$element .= '</label>';
|
|
||||||
|
|
||||||
return $element;
|
return $element . '</label>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ abstract class SocketAbstract implements SocketInterface
|
||||||
*/
|
*/
|
||||||
public function close() : void
|
public function close() : void
|
||||||
{
|
{
|
||||||
if (isset($this->sock)) {
|
if ($this->sock !== null) {
|
||||||
\socket_shutdown($this->sock, 2);
|
\socket_shutdown($this->sock, 2);
|
||||||
\socket_close($this->sock);
|
\socket_close($this->sock);
|
||||||
$this->sock = null;
|
$this->sock = null;
|
||||||
|
|
|
||||||
|
|
@ -120,11 +120,7 @@ class SmartDateTime extends \DateTime
|
||||||
$dayMonthNew = \cal_days_in_month($calendar, $monthNew, $yearNew);
|
$dayMonthNew = \cal_days_in_month($calendar, $monthNew, $yearNew);
|
||||||
$dayOld = (int) $this->format('d');
|
$dayOld = (int) $this->format('d');
|
||||||
|
|
||||||
if ($dayOld > $dayMonthNew || $dayOld === $dayMonthOld) {
|
$dayNew = $dayOld > $dayMonthNew || $dayOld === $dayMonthOld ? $dayMonthNew : $dayOld;
|
||||||
$dayNew = $dayMonthNew;
|
|
||||||
} else {
|
|
||||||
$dayNew = $dayOld;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->setDate($yearNew, $monthNew, $dayNew);
|
$this->setDate($yearNew, $monthNew, $dayNew);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -269,7 +269,7 @@ class Graph
|
||||||
|
|
||||||
$edges = $this->nodes[$id]->getEdges();
|
$edges = $this->nodes[$id]->getEdges();
|
||||||
foreach ($edges as $edge) {
|
foreach ($edges as $edge) {
|
||||||
$neighbor = !$edge->node1->isEqual($node) ? $edge->node1 : $edge->node2;
|
$neighbor = $edge->node1->isEqual($node) ? $edge->node2 : $edge->node1;
|
||||||
|
|
||||||
if (!isset($visited[$neighbor->getId()]) || !$visited[$neighbor->getId()]) {
|
if (!isset($visited[$neighbor->getId()]) || !$visited[$neighbor->getId()]) {
|
||||||
$parent[$neighbor->getId()] = $node;
|
$parent[$neighbor->getId()] = $node;
|
||||||
|
|
@ -583,7 +583,7 @@ class Graph
|
||||||
|
|
||||||
while (!empty($stack)) {
|
while (!empty($stack)) {
|
||||||
$cNode = \array_pop($stack);
|
$cNode = \array_pop($stack);
|
||||||
if (isset($visited[$cNode->getId()]) && $visited[$cNode->getId()] === true) {
|
if (isset($visited[$cNode->getId()]) && $visited[$cNode->getId()]) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -592,7 +592,7 @@ class Graph
|
||||||
|
|
||||||
$neighbors = $cNode->getNeighbors();
|
$neighbors = $cNode->getNeighbors();
|
||||||
foreach ($neighbors as $neighbor) {
|
foreach ($neighbors as $neighbor) {
|
||||||
if (!isset($visited[$neighbor->getId()]) || $visited[$neighbor->getId()] === false) {
|
if (!isset($visited[$neighbor->getId()]) || !$visited[$neighbor->getId()]) {
|
||||||
$stack[] = $neighbor;
|
$stack[] = $neighbor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -295,8 +295,7 @@ final class FileUtils
|
||||||
$name = \preg_replace("/[^A-Za-z0-9\-_.]/", '_', $name);
|
$name = \preg_replace("/[^A-Za-z0-9\-_.]/", '_', $name);
|
||||||
$name = \preg_replace("/_+/", '_', $name ?? '');
|
$name = \preg_replace("/_+/", '_', $name ?? '');
|
||||||
$name = \trim($name ?? '', '_');
|
$name = \trim($name ?? '', '_');
|
||||||
$name = \strtolower($name);
|
|
||||||
|
|
||||||
return $name;
|
return \strtolower($name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,7 @@ class File extends FileAbstract implements FileInterface
|
||||||
if (ContentPutMode::hasFlag($mode, ContentPutMode::APPEND) && $exists) {
|
if (ContentPutMode::hasFlag($mode, ContentPutMode::APPEND) && $exists) {
|
||||||
$content .= self::get($con, $path);
|
$content .= self::get($con, $path);
|
||||||
} elseif (ContentPutMode::hasFlag($mode, ContentPutMode::PREPEND) && $exists) {
|
} elseif (ContentPutMode::hasFlag($mode, ContentPutMode::PREPEND) && $exists) {
|
||||||
$content = $content . self::get($con, $path);
|
$content .= self::get($con, $path);
|
||||||
} elseif (!Directory::exists($con, \dirname($path))) {
|
} elseif (!Directory::exists($con, \dirname($path))) {
|
||||||
Directory::create($con, \dirname($path), 0755, true);
|
Directory::create($con, \dirname($path), 0755, true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -437,6 +437,6 @@ final class HttpUri implements UriInterface
|
||||||
*/
|
*/
|
||||||
public function getUserInfo() : string
|
public function getUserInfo() : string
|
||||||
{
|
{
|
||||||
return $this->user . (!empty($this->pass) ? ':' . $this->pass : '');
|
return $this->user . (empty($this->pass) ? '' : ':' . $this->pass);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -613,8 +613,7 @@ class Datamatrix extends TwoDAbstract
|
||||||
|
|
||||||
if ($this->isCharMode($tmpchr, self::ENC_X12)) {
|
if ($this->isCharMode($tmpchr, self::ENC_X12)) {
|
||||||
return self::ENC_X12;
|
return self::ENC_X12;
|
||||||
} elseif (!($this->isCharMode($tmpchr, self::ENC_X12)
|
} elseif (!$this->isCharMode($tmpchr, self::ENC_X12) && !$this->isCharMode($tmpchr, self::ENC_C40)
|
||||||
|| $this->isCharMode($tmpchr, self::ENC_C40))
|
|
||||||
) {
|
) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ final class Currency
|
||||||
try {
|
try {
|
||||||
$xml = new \SimpleXMLElement(Rest::request($request)->getBody());
|
$xml = new \SimpleXMLElement(Rest::request($request)->getBody());
|
||||||
|
|
||||||
if (!isset($xml->Cube)) {
|
if (!(property_exists($xml, 'Cube') && $xml->Cube !== null)) {
|
||||||
throw new \Exception('Invalid xml path'); // @codeCoverageIgnore
|
throw new \Exception('Invalid xml path'); // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -325,19 +325,12 @@ class Markdown
|
||||||
$methodName = 'block' . $CurrentBlock['type'] . 'Continue';
|
$methodName = 'block' . $CurrentBlock['type'] . 'Continue';
|
||||||
$Block = $this->{$methodName}($Line, $CurrentBlock);
|
$Block = $this->{$methodName}($Line, $CurrentBlock);
|
||||||
|
|
||||||
if (isset($Block))
|
if (isset($Block)) {
|
||||||
{
|
|
||||||
$CurrentBlock = $Block;
|
$CurrentBlock = $Block;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
} elseif ($this->isBlockCompletable($CurrentBlock['type'])) {
|
||||||
else
|
$methodName = 'block' . $CurrentBlock['type'] . 'Complete';
|
||||||
{
|
$CurrentBlock = $this->{$methodName}($CurrentBlock);
|
||||||
if ($this->isBlockCompletable($CurrentBlock['type']))
|
|
||||||
{
|
|
||||||
$methodName = 'block' . $CurrentBlock['type'] . 'Complete';
|
|
||||||
$CurrentBlock = $this->{$methodName}($CurrentBlock);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -450,12 +443,12 @@ class Markdown
|
||||||
return $Component['element'];
|
return $Component['element'];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function isBlockContinuable($Type)
|
protected function isBlockContinuable($Type): bool
|
||||||
{
|
{
|
||||||
return \method_exists($this, 'block' . $Type . 'Continue');
|
return \method_exists($this, 'block' . $Type . 'Continue');
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function isBlockCompletable($Type)
|
protected function isBlockCompletable($Type): bool
|
||||||
{
|
{
|
||||||
return \method_exists($this, 'block' . $Type . 'Complete');
|
return \method_exists($this, 'block' . $Type . 'Complete');
|
||||||
}
|
}
|
||||||
|
|
@ -474,7 +467,7 @@ class Markdown
|
||||||
{
|
{
|
||||||
$text = \substr($Line['body'], 4);
|
$text = \substr($Line['body'], 4);
|
||||||
|
|
||||||
$Block = [
|
return [
|
||||||
'element' => [
|
'element' => [
|
||||||
'name' => 'pre',
|
'name' => 'pre',
|
||||||
'element' => [
|
'element' => [
|
||||||
|
|
@ -483,8 +476,6 @@ class Markdown
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
return $Block;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -604,7 +595,7 @@ class Markdown
|
||||||
$Element['attributes'] = ['class' => "language-{$language}"];
|
$Element['attributes'] = ['class' => "language-{$language}"];
|
||||||
}
|
}
|
||||||
|
|
||||||
$Block = [
|
return [
|
||||||
'char' => $marker,
|
'char' => $marker,
|
||||||
'openerLength' => $openerLength,
|
'openerLength' => $openerLength,
|
||||||
'element' => [
|
'element' => [
|
||||||
|
|
@ -612,8 +603,6 @@ class Markdown
|
||||||
'element' => $Element,
|
'element' => $Element,
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
return $Block;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function blockFencedCodeContinue($Line, $Block)
|
protected function blockFencedCodeContinue($Line, $Block)
|
||||||
|
|
@ -656,11 +645,9 @@ class Markdown
|
||||||
{
|
{
|
||||||
$this->DefinitionData['Abbreviation'][$matches[1]] = $matches[2];
|
$this->DefinitionData['Abbreviation'][$matches[1]] = $matches[2];
|
||||||
|
|
||||||
$Block = [
|
return [
|
||||||
'hidden' => true,
|
'hidden' => true,
|
||||||
];
|
];
|
||||||
|
|
||||||
return $Block;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -671,13 +658,11 @@ class Markdown
|
||||||
{
|
{
|
||||||
if (\preg_match('/^\[\^(.+?)\]:[ ]?(.*)$/', $Line['text'], $matches))
|
if (\preg_match('/^\[\^(.+?)\]:[ ]?(.*)$/', $Line['text'], $matches))
|
||||||
{
|
{
|
||||||
$Block = [
|
return [
|
||||||
'label' => $matches[1],
|
'label' => $matches[1],
|
||||||
'text' => $matches[2],
|
'text' => $matches[2],
|
||||||
'hidden' => true,
|
'hidden' => true,
|
||||||
];
|
];
|
||||||
|
|
||||||
return $Block;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -747,18 +732,14 @@ class Markdown
|
||||||
|
|
||||||
$Block['element'] = $Element;
|
$Block['element'] = $Element;
|
||||||
|
|
||||||
$Block = $this->addDdElement($Line, $Block);
|
return $this->addDdElement($Line, $Block);
|
||||||
|
|
||||||
return $Block;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function blockDefinitionListContinue($Line, array $Block)
|
protected function blockDefinitionListContinue($Line, array $Block)
|
||||||
{
|
{
|
||||||
if ($Line['text'][0] === ':')
|
if ($Line['text'][0] === ':')
|
||||||
{
|
{
|
||||||
$Block = $this->addDdElement($Line, $Block);
|
return $this->addDdElement($Line, $Block);
|
||||||
|
|
||||||
return $Block;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -918,7 +899,7 @@ class Markdown
|
||||||
'name' => 'li',
|
'name' => 'li',
|
||||||
'handler' => [
|
'handler' => [
|
||||||
'function' => 'li',
|
'function' => 'li',
|
||||||
'argument' => !empty($matches[3]) ? [$matches[3]] : [],
|
'argument' => empty($matches[3]) ? [] : [$matches[3]],
|
||||||
'destination' => 'elements',
|
'destination' => 'elements',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
@ -1038,7 +1019,7 @@ class Markdown
|
||||||
{
|
{
|
||||||
if (\preg_match('/^>[ ]?+(.*+)/', $Line['text'], $matches))
|
if (\preg_match('/^>[ ]?+(.*+)/', $Line['text'], $matches))
|
||||||
{
|
{
|
||||||
$Block = [
|
return [
|
||||||
'element' => [
|
'element' => [
|
||||||
'name' => 'blockquote',
|
'name' => 'blockquote',
|
||||||
'handler' => [
|
'handler' => [
|
||||||
|
|
@ -1048,8 +1029,6 @@ class Markdown
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
return $Block;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1084,13 +1063,11 @@ class Markdown
|
||||||
|
|
||||||
if (\substr_count($Line['text'], $marker) >= 3 && \rtrim($Line['text'], " {$marker}") === '')
|
if (\substr_count($Line['text'], $marker) >= 3 && \rtrim($Line['text'], " {$marker}") === '')
|
||||||
{
|
{
|
||||||
$Block = [
|
return [
|
||||||
'element' => [
|
'element' => [
|
||||||
'name' => 'hr',
|
'name' => 'hr',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
return $Block;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1307,9 +1284,8 @@ class Markdown
|
||||||
$DOMDocument->documentElement->nodeValue = 'placeholder\x1A';
|
$DOMDocument->documentElement->nodeValue = 'placeholder\x1A';
|
||||||
|
|
||||||
$markup = $DOMDocument->saveHTML($DOMDocument->documentElement);
|
$markup = $DOMDocument->saveHTML($DOMDocument->documentElement);
|
||||||
$markup = \str_replace('placeholder\x1A', $elementText, $markup);
|
|
||||||
|
|
||||||
return $markup;
|
return \str_replace('placeholder\x1A', $elementText, $markup);
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
@ -1329,11 +1305,9 @@ class Markdown
|
||||||
|
|
||||||
$this->DefinitionData['Reference'][$id] = $Data;
|
$this->DefinitionData['Reference'][$id] = $Data;
|
||||||
|
|
||||||
$Block = [
|
return [
|
||||||
'element' => [],
|
'element' => [],
|
||||||
];
|
];
|
||||||
|
|
||||||
return $Block;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1892,7 +1866,7 @@ class Markdown
|
||||||
{
|
{
|
||||||
if (\preg_match('/^\s*\[(.*?)\]/', $remainder, $matches))
|
if (\preg_match('/^\s*\[(.*?)\]/', $remainder, $matches))
|
||||||
{
|
{
|
||||||
$definition = \strlen($matches[1]) ? $matches[1] : $Element['handler']['argument'];
|
$definition = \strlen($matches[1]) !== 0 ? $matches[1] : $Element['handler']['argument'];
|
||||||
$definition = \strtolower($definition);
|
$definition = \strtolower($definition);
|
||||||
|
|
||||||
$extent += \strlen($matches[0]);
|
$extent += \strlen($matches[0]);
|
||||||
|
|
@ -2053,7 +2027,7 @@ class Markdown
|
||||||
|
|
||||||
protected function inlineUrl($Excerpt)
|
protected function inlineUrl($Excerpt)
|
||||||
{
|
{
|
||||||
if ($this->urlsLinked !== true || ! isset($Excerpt['text'][2]) || $Excerpt['text'][2] !== '/')
|
if (!$this->urlsLinked || ! isset($Excerpt['text'][2]) || $Excerpt['text'][2] !== '/')
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -2063,7 +2037,7 @@ class Markdown
|
||||||
) {
|
) {
|
||||||
$url = $matches[0][0];
|
$url = $matches[0][0];
|
||||||
|
|
||||||
$Inline = [
|
return [
|
||||||
'extent' => \strlen($matches[0][0]),
|
'extent' => \strlen($matches[0][0]),
|
||||||
'position' => $matches[0][1],
|
'position' => $matches[0][1],
|
||||||
'element' => [
|
'element' => [
|
||||||
|
|
@ -2074,8 +2048,6 @@ class Markdown
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
return $Inline;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2183,9 +2155,7 @@ class Markdown
|
||||||
$Element['element'] = $this->elementsApplyRecursiveDepthFirst($closure, $Element['element']);
|
$Element['element'] = $this->elementsApplyRecursiveDepthFirst($closure, $Element['element']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$Element = $closure($Element);
|
return $closure($Element);
|
||||||
|
|
||||||
return $Element;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function elementsApplyRecursive($closure, array $Elements)
|
protected function elementsApplyRecursive($closure, array $Elements)
|
||||||
|
|
@ -2269,17 +2239,12 @@ class Markdown
|
||||||
elseif (isset($Element['element']))
|
elseif (isset($Element['element']))
|
||||||
{
|
{
|
||||||
$markup .= $this->element($Element['element']);
|
$markup .= $this->element($Element['element']);
|
||||||
|
} elseif (!$permitRawHtml) {
|
||||||
|
$markup .= self::escape($text, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!$permitRawHtml)
|
$markup .= $text;
|
||||||
{
|
|
||||||
$markup .= self::escape($text, true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$markup .= $text;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$markup .= $hasName ? '</' . $Element['name'] . '>' : '';
|
$markup .= $hasName ? '</' . $Element['name'] . '>' : '';
|
||||||
|
|
@ -2292,7 +2257,7 @@ class Markdown
|
||||||
return $markup;
|
return $markup;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function elements(array $Elements)
|
protected function elements(array $Elements): string
|
||||||
{
|
{
|
||||||
$markup = '';
|
$markup = '';
|
||||||
|
|
||||||
|
|
@ -2309,15 +2274,13 @@ class Markdown
|
||||||
? $Element['autobreak'] : isset($Element['name'])
|
? $Element['autobreak'] : isset($Element['name'])
|
||||||
);
|
);
|
||||||
// (autobreak === false) covers both sides of an element
|
// (autobreak === false) covers both sides of an element
|
||||||
$autoBreak = !$autoBreak ? $autoBreak : $autoBreakNext;
|
$autoBreak = $autoBreak ? $autoBreakNext : $autoBreak;
|
||||||
|
|
||||||
$markup .= ($autoBreak ? "\n" : '') . $this->element($Element);
|
$markup .= ($autoBreak ? "\n" : '') . $this->element($Element);
|
||||||
$autoBreak = $autoBreakNext;
|
$autoBreak = $autoBreakNext;
|
||||||
}
|
}
|
||||||
|
|
||||||
$markup .= $autoBreak ? "\n" : '';
|
return $markup . ($autoBreak ? "\n" : '');
|
||||||
|
|
||||||
return $markup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# ~
|
# ~
|
||||||
|
|
@ -2377,9 +2340,7 @@ class Markdown
|
||||||
{
|
{
|
||||||
$parsedown = new self();
|
$parsedown = new self();
|
||||||
|
|
||||||
$markup = $parsedown->text($text);
|
return $parsedown->text($text);
|
||||||
|
|
||||||
return $markup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function sanitiseElement(array $Element)
|
protected function sanitiseElement(array $Element)
|
||||||
|
|
@ -2440,7 +2401,7 @@ class Markdown
|
||||||
# Static Methods
|
# Static Methods
|
||||||
#
|
#
|
||||||
|
|
||||||
protected static function escape($text, $allowQuotes = false)
|
protected static function escape($text, $allowQuotes = false): string
|
||||||
{
|
{
|
||||||
return \htmlspecialchars($text, $allowQuotes ? \ENT_NOQUOTES : \ENT_QUOTES, 'UTF-8');
|
return \htmlspecialchars($text, $allowQuotes ? \ENT_NOQUOTES : \ENT_QUOTES, 'UTF-8');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -178,8 +178,8 @@ final class ApplicationManagerTest extends \PHPUnit\Framework\TestCase
|
||||||
*/
|
*/
|
||||||
public function testInvalidSourceUninstallPath() : void
|
public function testInvalidSourceUninstallPath() : void
|
||||||
{
|
{
|
||||||
self::assertFalse($this->appManager->uninstall(__DIR__ . '/invalid', __DIR__));
|
self::assertFalse($this->appManager->uninstall(__DIR__ . '/invalid'));
|
||||||
self::assertFalse($this->appManager->uninstall(__DIR__, __DIR__));
|
self::assertFalse($this->appManager->uninstall(__DIR__));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,9 @@ declare(strict_types=1);
|
||||||
\setlocale(\LC_ALL, 'en_US.UTF-8');
|
\setlocale(\LC_ALL, 'en_US.UTF-8');
|
||||||
|
|
||||||
if (\is_file('vendor/autoload.php')) {
|
if (\is_file('vendor/autoload.php')) {
|
||||||
include_once 'vendor/autoload.php';
|
include_once __DIR__ . '/vendor/autoload.php';
|
||||||
} elseif (\is_file('../../vendor/autoload.php')) {
|
} elseif (\is_file('../../vendor/autoload.php')) {
|
||||||
include_once '../../vendor/autoload.php';
|
include_once __DIR__ . '/../../vendor/autoload.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once __DIR__ . '/../Autoloader.php';
|
require_once __DIR__ . '/../Autoloader.php';
|
||||||
|
|
@ -455,7 +455,7 @@ function phpServe() : void
|
||||||
|
|
||||||
// Execute the command and store the process ID
|
// Execute the command and store the process ID
|
||||||
$output = [];
|
$output = [];
|
||||||
echo \sprintf('Starting server...') . \PHP_EOL;
|
echo 'Starting server...' . \PHP_EOL;
|
||||||
echo \sprintf(' Current directory: %s', \getcwd()) . \PHP_EOL;
|
echo \sprintf(' Current directory: %s', \getcwd()) . \PHP_EOL;
|
||||||
echo \sprintf(' %s', $command);
|
echo \sprintf(' %s', $command);
|
||||||
\exec($command, $output);
|
\exec($command, $output);
|
||||||
|
|
@ -480,7 +480,7 @@ function phpServe() : void
|
||||||
|
|
||||||
// Kill the web server when the process ends
|
// Kill the web server when the process ends
|
||||||
\register_shutdown_function(function() use ($killCommand, $pid) : void {
|
\register_shutdown_function(function() use ($killCommand, $pid) : void {
|
||||||
echo \PHP_EOL . \sprintf('Stopping server...') . \PHP_EOL;
|
echo \PHP_EOL . 'Stopping server...' . \PHP_EOL;
|
||||||
echo \sprintf(' %s - Killing process with ID %d', \date('r'), $pid) . \PHP_EOL;
|
echo \sprintf(' %s - Killing process with ID %d', \date('r'), $pid) . \PHP_EOL;
|
||||||
\exec($killCommand . $pid);
|
\exec($killCommand . $pid);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ final class DispatcherTest extends \PHPUnit\Framework\TestCase
|
||||||
self::assertTrue(
|
self::assertTrue(
|
||||||
!empty(
|
!empty(
|
||||||
$this->app->dispatcher->dispatch(
|
$this->app->dispatcher->dispatch(
|
||||||
function($req, $resp, $data = null) { return true; },
|
function($req, $resp, $data = null): bool { return true; },
|
||||||
new HttpRequest(new HttpUri(''), $localization),
|
new HttpRequest(new HttpUri(''), $localization),
|
||||||
new HttpResponse($localization)
|
new HttpResponse($localization)
|
||||||
)
|
)
|
||||||
|
|
@ -95,7 +95,7 @@ final class DispatcherTest extends \PHPUnit\Framework\TestCase
|
||||||
self::assertTrue(
|
self::assertTrue(
|
||||||
!empty(
|
!empty(
|
||||||
$this->app->dispatcher->dispatch(
|
$this->app->dispatcher->dispatch(
|
||||||
function($req) { return true; }
|
function($req): bool { return true; }
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
@ -182,7 +182,7 @@ final class DispatcherTest extends \PHPUnit\Framework\TestCase
|
||||||
!empty(
|
!empty(
|
||||||
$this->app->dispatcher->dispatch(
|
$this->app->dispatcher->dispatch(
|
||||||
[
|
[
|
||||||
function($app, $req, $resp, $data = null) { return true; },
|
function($app, $req, $resp, $data = null): bool { return true; },
|
||||||
'phpOMS\tests\Dispatcher\TestController:testFunction',
|
'phpOMS\tests\Dispatcher\TestController:testFunction',
|
||||||
'phpOMS\tests\Dispatcher\TestController::testFunctionStatic',
|
'phpOMS\tests\Dispatcher\TestController::testFunctionStatic',
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -16,17 +16,17 @@ namespace phpOMS\tests\Dispatcher;
|
||||||
|
|
||||||
class TestController
|
class TestController
|
||||||
{
|
{
|
||||||
public function testFunction($req, $resp, $data = null)
|
public function testFunction($req, $resp, $data = null): bool
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testFunctionNoPara()
|
public function testFunctionNoPara(): bool
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function testFunctionStatic($req, $resp, $data = null)
|
public static function testFunctionStatic($req, $resp, $data = null): bool
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ final class EventManagerTest extends \PHPUnit\Framework\TestCase
|
||||||
*/
|
*/
|
||||||
public function testAdd() : void
|
public function testAdd() : void
|
||||||
{
|
{
|
||||||
self::assertTrue($this->event->attach('group', function() { return true; }, false, false));
|
self::assertTrue($this->event->attach('group', function(): bool { return true; }, false, false));
|
||||||
self::assertEquals(1, $this->event->count());
|
self::assertEquals(1, $this->event->count());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -63,7 +63,7 @@ final class EventManagerTest extends \PHPUnit\Framework\TestCase
|
||||||
*/
|
*/
|
||||||
public function testClear() : void
|
public function testClear() : void
|
||||||
{
|
{
|
||||||
self::assertTrue($this->event->attach('group', function() { return true; }, false, false));
|
self::assertTrue($this->event->attach('group', function(): bool { return true; }, false, false));
|
||||||
self::assertEquals(1, $this->event->count());
|
self::assertEquals(1, $this->event->count());
|
||||||
$this->event->clear();
|
$this->event->clear();
|
||||||
|
|
||||||
|
|
@ -77,8 +77,8 @@ final class EventManagerTest extends \PHPUnit\Framework\TestCase
|
||||||
*/
|
*/
|
||||||
public function testAddMultiple() : void
|
public function testAddMultiple() : void
|
||||||
{
|
{
|
||||||
self::assertTrue($this->event->attach('group', function() { return true; }, false, false));
|
self::assertTrue($this->event->attach('group', function(): bool { return true; }, false, false));
|
||||||
self::assertTrue($this->event->attach('group', function() { return true; }, false, false));
|
self::assertTrue($this->event->attach('group', function(): bool { return true; }, false, false));
|
||||||
self::assertEquals(1, $this->event->count());
|
self::assertEquals(1, $this->event->count());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -185,7 +185,7 @@ final class EventManagerTest extends \PHPUnit\Framework\TestCase
|
||||||
*/
|
*/
|
||||||
public function testReset() : void
|
public function testReset() : void
|
||||||
{
|
{
|
||||||
self::assertTrue($this->event->attach('group', function() { return true; }, false, true));
|
self::assertTrue($this->event->attach('group', function(): bool { return true; }, false, true));
|
||||||
$this->event->addGroup('group', 'id1');
|
$this->event->addGroup('group', 'id1');
|
||||||
$this->event->addGroup('group', 'id2');
|
$this->event->addGroup('group', 'id2');
|
||||||
|
|
||||||
|
|
@ -201,7 +201,7 @@ final class EventManagerTest extends \PHPUnit\Framework\TestCase
|
||||||
*/
|
*/
|
||||||
public function testNoReset() : void
|
public function testNoReset() : void
|
||||||
{
|
{
|
||||||
self::assertTrue($this->event->attach('group', function() { return true; }, false, false));
|
self::assertTrue($this->event->attach('group', function(): bool { return true; }, false, false));
|
||||||
$this->event->addGroup('group', 'id1');
|
$this->event->addGroup('group', 'id1');
|
||||||
$this->event->addGroup('group', 'id2');
|
$this->event->addGroup('group', 'id2');
|
||||||
|
|
||||||
|
|
@ -217,7 +217,7 @@ final class EventManagerTest extends \PHPUnit\Framework\TestCase
|
||||||
*/
|
*/
|
||||||
public function testDetach() : void
|
public function testDetach() : void
|
||||||
{
|
{
|
||||||
$this->event->attach('group', function() { return true; }, false, true);
|
$this->event->attach('group', function(): bool { return true; }, false, true);
|
||||||
$this->event->addGroup('group', 'id1');
|
$this->event->addGroup('group', 'id1');
|
||||||
$this->event->addGroup('group', 'id2');
|
$this->event->addGroup('group', 'id2');
|
||||||
|
|
||||||
|
|
@ -234,7 +234,7 @@ final class EventManagerTest extends \PHPUnit\Framework\TestCase
|
||||||
*/
|
*/
|
||||||
public function testInvalidDetach() : void
|
public function testInvalidDetach() : void
|
||||||
{
|
{
|
||||||
$this->event->attach('group', function() { return true; }, false, true);
|
$this->event->attach('group', function(): bool { return true; }, false, true);
|
||||||
$this->event->addGroup('group', 'id1');
|
$this->event->addGroup('group', 'id1');
|
||||||
$this->event->addGroup('group', 'id2');
|
$this->event->addGroup('group', 'id2');
|
||||||
|
|
||||||
|
|
@ -249,8 +249,8 @@ final class EventManagerTest extends \PHPUnit\Framework\TestCase
|
||||||
*/
|
*/
|
||||||
public function testRemove() : void
|
public function testRemove() : void
|
||||||
{
|
{
|
||||||
self::assertTrue($this->event->attach('group1', function() { return true; }, true, false));
|
self::assertTrue($this->event->attach('group1', function(): bool { return true; }, true, false));
|
||||||
self::assertTrue($this->event->attach('group2', function() { return true; }, true, false));
|
self::assertTrue($this->event->attach('group2', function(): bool { return true; }, true, false));
|
||||||
|
|
||||||
self::assertEquals(2, $this->event->count());
|
self::assertEquals(2, $this->event->count());
|
||||||
$this->event->trigger('group1');
|
$this->event->trigger('group1');
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ final class MoneyTest extends \PHPUnit\Framework\TestCase
|
||||||
public function testMoneyLocalization() : void
|
public function testMoneyLocalization() : void
|
||||||
{
|
{
|
||||||
$money = new Money(12345678);
|
$money = new Money(12345678);
|
||||||
self::assertEquals('€ 9.992,30', $money->setInt(99923000)->setLocalization('.', ',', ISO4217SymbolEnum::_EUR, 0)->getCurrency());
|
self::assertEquals('€ 9.992,30', $money->setInt(99923000)->setLocalization('.', ',')->getCurrency());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ final class GammaTest extends \PHPUnit\Framework\TestCase
|
||||||
];
|
];
|
||||||
|
|
||||||
for ($i = 1; $i <= 10; ++$i) {
|
for ($i = 1; $i <= 10; ++$i) {
|
||||||
if (!(\abs($spouge[$i - 1] - Gamma::spougeApproximation($i / 3)) < 0.01)) {
|
if (\abs($spouge[$i - 1] - Gamma::spougeApproximation($i / 3)) >= 0.01) {
|
||||||
self::assertTrue(false);
|
self::assertTrue(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -77,7 +77,7 @@ final class GammaTest extends \PHPUnit\Framework\TestCase
|
||||||
];
|
];
|
||||||
|
|
||||||
for ($i = 1; $i <= 10; ++$i) {
|
for ($i = 1; $i <= 10; ++$i) {
|
||||||
if (!(\abs($stirling[$i - 1] - Gamma::stirlingApproximation($i / 3)) < 0.01)) {
|
if (\abs($stirling[$i - 1] - Gamma::stirlingApproximation($i / 3)) >= 0.01) {
|
||||||
self::assertTrue(false);
|
self::assertTrue(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -97,7 +97,7 @@ final class GammaTest extends \PHPUnit\Framework\TestCase
|
||||||
];
|
];
|
||||||
|
|
||||||
for ($i = 1; $i <= 10; ++$i) {
|
for ($i = 1; $i <= 10; ++$i) {
|
||||||
if (!(\abs($gsl[$i - 1] - Gamma::lanczosApproximationReal($i / 3)) < 0.01)) {
|
if (\abs($gsl[$i - 1] - Gamma::lanczosApproximationReal($i / 3)) >= 0.01) {
|
||||||
self::assertTrue(false);
|
self::assertTrue(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -117,7 +117,7 @@ final class GammaTest extends \PHPUnit\Framework\TestCase
|
||||||
];
|
];
|
||||||
|
|
||||||
for ($i = 1; $i <= 10; ++$i) {
|
for ($i = 1; $i <= 10; ++$i) {
|
||||||
if (!(\abs($gsl[$i - 1] - Gamma::logGamma($i)) < 0.01)) {
|
if (\abs($gsl[$i - 1] - Gamma::logGamma($i)) >= 0.01) {
|
||||||
self::assertTrue(false);
|
self::assertTrue(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
function has𠀊Unicode()
|
function has𠀊Unicode(): bool
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
function noDeprecated()
|
function noDeprecated(): string
|
||||||
{
|
{
|
||||||
return \is_string('');
|
return \is_string('');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
function noUnicode()
|
function noUnicode(): bool
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ final class GraphTest extends \PHPUnit\Framework\TestCase
|
||||||
self::assertEquals(0, $this->graph->getCircuitRank());
|
self::assertEquals(0, $this->graph->getCircuitRank());
|
||||||
|
|
||||||
self::assertTrue($this->graph->isConnected());
|
self::assertTrue($this->graph->isConnected());
|
||||||
self::assertTrue($this->graph->isBipartite(1));
|
self::assertTrue($this->graph->isBipartite());
|
||||||
self::assertFalse($this->graph->isDirected());
|
self::assertFalse($this->graph->isDirected());
|
||||||
self::assertFalse($this->graph->hasCycle());
|
self::assertFalse($this->graph->hasCycle());
|
||||||
|
|
||||||
|
|
@ -639,7 +639,7 @@ final class GraphTest extends \PHPUnit\Framework\TestCase
|
||||||
$node3->setNodeRelative($node5);
|
$node3->setNodeRelative($node5);
|
||||||
$node4->setNodeRelative($node5);
|
$node4->setNodeRelative($node5);
|
||||||
|
|
||||||
$paths = $this->graph->getFloydWarshallShortestPath($node0, $node5);
|
$paths = $this->graph->getFloydWarshallShortestPath();
|
||||||
self::assertGreaterThan(1, $paths);
|
self::assertGreaterThan(1, $paths);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -679,7 +679,7 @@ final class GraphTest extends \PHPUnit\Framework\TestCase
|
||||||
$node3->setNodeRelative($node5);
|
$node3->setNodeRelative($node5);
|
||||||
$node4->setNodeRelative($node5);
|
$node4->setNodeRelative($node5);
|
||||||
|
|
||||||
$paths = $this->graph->longestPath($node0, $node5);
|
$paths = $this->graph->longestPath();
|
||||||
self::assertGreaterThan(1, $paths);
|
self::assertGreaterThan(1, $paths);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user