mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-19 04:58:41 +00:00
Use self instead of class
This commit is contained in:
parent
4b955eeb63
commit
e616f844ab
|
|
@ -263,7 +263,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function select(...$columns) : Builder
|
||||
public function select(...$columns) : self
|
||||
{
|
||||
$this->type = QueryType::SELECT;
|
||||
|
||||
|
|
@ -289,7 +289,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function random(...$columns) : Builder
|
||||
public function random(...$columns) : self
|
||||
{
|
||||
$this->select(...$columns);
|
||||
|
||||
|
|
@ -307,7 +307,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function bind($binds) : Builder
|
||||
public function bind($binds) : self
|
||||
{
|
||||
if (\is_array($binds)) {
|
||||
$this->binds += $binds;
|
||||
|
|
@ -327,7 +327,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function newQuery() : Builder
|
||||
public function newQuery() : self
|
||||
{
|
||||
return new static($this->connection, $this->isReadOnly);
|
||||
}
|
||||
|
|
@ -355,7 +355,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function raw(string $raw) : Builder
|
||||
public function raw(string $raw) : self
|
||||
{
|
||||
if (!$this->isValidReadOnly($raw)) {
|
||||
throw new \Exception();
|
||||
|
|
@ -405,7 +405,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function selectRaw($expression) : Builder
|
||||
public function selectRaw($expression) : self
|
||||
{
|
||||
$this->selects[null][] = $expression;
|
||||
|
||||
|
|
@ -419,7 +419,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function distinct() : Builder
|
||||
public function distinct() : self
|
||||
{
|
||||
$this->distinct = true;
|
||||
|
||||
|
|
@ -435,7 +435,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function from(...$tables) : Builder
|
||||
public function from(...$tables) : self
|
||||
{
|
||||
foreach ($tables as $key => $table) {
|
||||
if (\is_string($table) || $table instanceof \Closure) {
|
||||
|
|
@ -457,7 +457,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function fromRaw($expression) : Builder
|
||||
public function fromRaw($expression) : self
|
||||
{
|
||||
$this->from[null][] = $expression;
|
||||
|
||||
|
|
@ -478,7 +478,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function where($columns, $operator = null, $values = null, $boolean = 'and') : Builder
|
||||
public function where($columns, $operator = null, $values = null, $boolean = 'and') : self
|
||||
{
|
||||
if (!\is_array($columns)) {
|
||||
$columns = [$columns];
|
||||
|
|
@ -534,7 +534,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function andWhere($where, $operator = null, $values = null) : Builder
|
||||
public function andWhere($where, $operator = null, $values = null) : self
|
||||
{
|
||||
return $this->where($where, $operator, $values, 'and');
|
||||
}
|
||||
|
|
@ -550,7 +550,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function orWhere($where, $operator = null, $values = null) : Builder
|
||||
public function orWhere($where, $operator = null, $values = null) : self
|
||||
{
|
||||
return $this->where($where, $operator, $values, 'or');
|
||||
}
|
||||
|
|
@ -566,7 +566,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function whereIn($column, $values = null, string $boolean = 'and') : Builder
|
||||
public function whereIn($column, $values = null, string $boolean = 'and') : self
|
||||
{
|
||||
$this->where($column, 'in', $values, $boolean);
|
||||
|
||||
|
|
@ -583,7 +583,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function whereNull($column, string $boolean = 'and') : Builder
|
||||
public function whereNull($column, string $boolean = 'and') : self
|
||||
{
|
||||
$this->where($column, '=', null, $boolean);
|
||||
|
||||
|
|
@ -600,7 +600,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function whereNotNull($column, string $boolean = 'and') : Builder
|
||||
public function whereNotNull($column, string $boolean = 'and') : self
|
||||
{
|
||||
$this->where($column, '!=', null, $boolean);
|
||||
|
||||
|
|
@ -616,7 +616,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function groupBy(...$columns) : Builder
|
||||
public function groupBy(...$columns) : self
|
||||
{
|
||||
foreach ($columns as $key => $column) {
|
||||
if (\is_string($column) || $column instanceof \Closure) {
|
||||
|
|
@ -638,7 +638,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function newest($column) : Builder
|
||||
public function newest($column) : self
|
||||
{
|
||||
$this->orderBy($column, 'DESC');
|
||||
|
||||
|
|
@ -654,7 +654,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function oldest($column) : Builder
|
||||
public function oldest($column) : self
|
||||
{
|
||||
$this->orderBy($column, 'ASC');
|
||||
|
||||
|
|
@ -671,7 +671,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function orderBy($columns, $order = 'DESC') : Builder
|
||||
public function orderBy($columns, $order = 'DESC') : self
|
||||
{
|
||||
if (\is_string($columns) || $columns instanceof \Closure) {
|
||||
if (!\is_string($order)) {
|
||||
|
|
@ -703,7 +703,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function offset(int $offset) : Builder
|
||||
public function offset(int $offset) : self
|
||||
{
|
||||
$this->offset = $offset;
|
||||
|
||||
|
|
@ -719,7 +719,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function limit(int $limit) : Builder
|
||||
public function limit(int $limit) : self
|
||||
{
|
||||
$this->limit = $limit;
|
||||
|
||||
|
|
@ -735,7 +735,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function union($query) : Builder
|
||||
public function union($query) : self
|
||||
{
|
||||
if (!\is_array($query)) {
|
||||
$this->unions[] = $query;
|
||||
|
|
@ -800,7 +800,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function count(string $table = '*') : Builder
|
||||
public function count(string $table = '*') : self
|
||||
{
|
||||
// todo: don't do this as string, create new object new \count(); this can get handled by the grammar parser WAY better
|
||||
return $this->select('COUNT(' . $table . ')');
|
||||
|
|
@ -861,7 +861,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function insert(...$columns) : Builder
|
||||
public function insert(...$columns) : self
|
||||
{
|
||||
if ($this->isReadOnly) {
|
||||
throw new \Exception();
|
||||
|
|
@ -885,7 +885,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function into($table) : Builder
|
||||
public function into($table) : self
|
||||
{
|
||||
$this->into = $table;
|
||||
|
||||
|
|
@ -901,7 +901,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function values(...$values) : Builder
|
||||
public function values(...$values) : self
|
||||
{
|
||||
$this->values[] = $values;
|
||||
|
||||
|
|
@ -929,7 +929,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function value($value) : Builder
|
||||
public function value($value) : self
|
||||
{
|
||||
\end($this->values);
|
||||
$key = \key($this->values);
|
||||
|
|
@ -954,7 +954,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function sets(...$sets) : Builder
|
||||
public function sets(...$sets) : self
|
||||
{
|
||||
$this->sets[$sets[0]] = $sets[1] ?? null;
|
||||
|
||||
|
|
@ -970,7 +970,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function set($set) : Builder
|
||||
public function set($set) : self
|
||||
{
|
||||
$this->sets[\key($set)] = \current($set);
|
||||
|
||||
|
|
@ -988,7 +988,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function update(...$tables) : Builder
|
||||
public function update(...$tables) : self
|
||||
{
|
||||
if ($this->isReadOnly) {
|
||||
throw new \Exception();
|
||||
|
|
@ -1014,7 +1014,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function delete() : Builder
|
||||
public function delete() : self
|
||||
{
|
||||
if ($this->isReadOnly) {
|
||||
throw new \Exception();
|
||||
|
|
@ -1054,7 +1054,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function join($table, string $type = JoinType::JOIN) : Builder
|
||||
public function join($table, string $type = JoinType::JOIN) : self
|
||||
{
|
||||
if (\is_string($table) || $table instanceof \Closure) {
|
||||
$this->joins[] = ['type' => $type, 'table' => $table];
|
||||
|
|
@ -1072,7 +1072,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function leftJoin($column) : Builder
|
||||
public function leftJoin($column) : self
|
||||
{
|
||||
return $this->join($column, JoinType::LEFT_JOIN);
|
||||
}
|
||||
|
|
@ -1084,7 +1084,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function leftOuterJoin($column) : Builder
|
||||
public function leftOuterJoin($column) : self
|
||||
{
|
||||
return $this->join($column, JoinType::LEFT_OUTER_JOIN);
|
||||
}
|
||||
|
|
@ -1096,7 +1096,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function leftInnerJoin($column) : Builder
|
||||
public function leftInnerJoin($column) : self
|
||||
{
|
||||
return $this->join($column, JoinType::LEFT_INNER_JOIN);
|
||||
}
|
||||
|
|
@ -1108,7 +1108,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function rightJoin($column) : Builder
|
||||
public function rightJoin($column) : self
|
||||
{
|
||||
return $this->join($column, JoinType::RIGHT_JOIN);
|
||||
}
|
||||
|
|
@ -1120,7 +1120,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function rightOuterJoin($column) : Builder
|
||||
public function rightOuterJoin($column) : self
|
||||
{
|
||||
return $this->join($column, JoinType::RIGHT_OUTER_JOIN);
|
||||
}
|
||||
|
|
@ -1132,7 +1132,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function rightInnerJoin($column) : Builder
|
||||
public function rightInnerJoin($column) : self
|
||||
{
|
||||
return $this->join($column, JoinType::RIGHT_INNER_JOIN);
|
||||
}
|
||||
|
|
@ -1144,7 +1144,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function outerJoin($column) : Builder
|
||||
public function outerJoin($column) : self
|
||||
{
|
||||
return $this->join($column, JoinType::OUTER_JOIN);
|
||||
}
|
||||
|
|
@ -1156,7 +1156,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function innerJoin($column) : Builder
|
||||
public function innerJoin($column) : self
|
||||
{
|
||||
return $this->join($column, JoinType::INNER_JOIN);
|
||||
}
|
||||
|
|
@ -1168,7 +1168,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function crossJoin($column) : Builder
|
||||
public function crossJoin($column) : self
|
||||
{
|
||||
return $this->join($column, JoinType::CROSS_JOIN);
|
||||
}
|
||||
|
|
@ -1180,7 +1180,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function fullJoin($column) : Builder
|
||||
public function fullJoin($column) : self
|
||||
{
|
||||
return $this->join($column, JoinType::FULL_JOIN);
|
||||
}
|
||||
|
|
@ -1192,7 +1192,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function fullOuterJoin($column) : Builder
|
||||
public function fullOuterJoin($column) : self
|
||||
{
|
||||
return $this->join($column, JoinType::FULL_OUTER_JOIN);
|
||||
}
|
||||
|
|
@ -1204,7 +1204,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function rollback() : Builder
|
||||
public function rollback() : self
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
|
@ -1216,7 +1216,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function on($columns, $operator = null, $values = null, $boolean = 'and') : Builder
|
||||
public function on($columns, $operator = null, $values = null, $boolean = 'and') : self
|
||||
{
|
||||
if ($operator !== null && !\is_array($operator) && !\in_array(\strtolower($operator), self::OPERATORS)) {
|
||||
throw new \InvalidArgumentException('Unknown operator.');
|
||||
|
|
@ -1257,7 +1257,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function orOn($columns, $operator = null, $values = null) : Builder
|
||||
public function orOn($columns, $operator = null, $values = null) : self
|
||||
{
|
||||
return $this->on($columns, $operator, $values, 'or');
|
||||
}
|
||||
|
|
@ -1269,7 +1269,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function andOn($columns, $operator = null, $values = null) : Builder
|
||||
public function andOn($columns, $operator = null, $values = null) : self
|
||||
{
|
||||
return $this->on($columns, $operator, $values, 'and');
|
||||
}
|
||||
|
|
@ -1285,7 +1285,7 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function merge(Builder $query) : Builder
|
||||
public function merge(self $query) : self
|
||||
{
|
||||
return clone($this);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class Builder extends QueryBuilder
|
|||
$this->grammar = $connection->getSchemaGrammar();
|
||||
}
|
||||
|
||||
public function drop(...$table) : Builder
|
||||
public function drop(...$table) : self
|
||||
{
|
||||
$this->type = QueryType::DROP;
|
||||
$this->drop += $table;
|
||||
|
|
@ -55,14 +55,14 @@ class Builder extends QueryBuilder
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function selectTables() : Builder
|
||||
public function selectTables() : self
|
||||
{
|
||||
$this->type = QueryType::TABLES;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function selectFields(string $table) : Builder
|
||||
public function selectFields(string $table) : self
|
||||
{
|
||||
$this->type = QueryType::FIELDS;
|
||||
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ final class Money implements \Serializable
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setLocalization(string $thousands = ',', string $decimal = '.', string $symbol = '', int $position = 0) : Money
|
||||
public function setLocalization(string $thousands = ',', string $decimal = '.', string $symbol = '', int $position = 0) : self
|
||||
{
|
||||
$this->thousands = $thousands;
|
||||
$this->decimal = $decimal;
|
||||
|
|
@ -159,7 +159,7 @@ final class Money implements \Serializable
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setString(string $value) : Money
|
||||
public function setString(string $value) : self
|
||||
{
|
||||
$this->value = self::toInt($value, $this->thousands, $this->decimal);
|
||||
|
||||
|
|
@ -211,13 +211,13 @@ final class Money implements \Serializable
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function add($value) : Money
|
||||
public function add($value) : self
|
||||
{
|
||||
if (\is_string($value) || is_float($value)) {
|
||||
$this->value += self::toInt((string) $value, $this->thousands, $this->decimal);
|
||||
} elseif (\is_int($value)) {
|
||||
$this->value += $value;
|
||||
} elseif ($value instanceof Money) {
|
||||
} elseif ($value instanceof self) {
|
||||
$this->value += $value->getInt();
|
||||
}
|
||||
|
||||
|
|
@ -245,13 +245,13 @@ final class Money implements \Serializable
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function sub($value) : Money
|
||||
public function sub($value) : self
|
||||
{
|
||||
if (\is_string($value) || is_float($value)) {
|
||||
$this->value -= self::toInt((string) $value, $this->thousands, $this->decimal);
|
||||
} elseif (\is_int($value)) {
|
||||
$this->value -= $value;
|
||||
} elseif ($value instanceof Money) {
|
||||
} elseif ($value instanceof self) {
|
||||
$this->value -= $value->getInt();
|
||||
}
|
||||
|
||||
|
|
@ -267,7 +267,7 @@ final class Money implements \Serializable
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function mult($value) : Money
|
||||
public function mult($value) : self
|
||||
{
|
||||
if (\is_float($value) || is_int($value)) {
|
||||
$this->value = (int) ($this->value * $value);
|
||||
|
|
@ -285,7 +285,7 @@ final class Money implements \Serializable
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function div($value) : Money
|
||||
public function div($value) : self
|
||||
{
|
||||
if (\is_float($value) || is_int($value)) {
|
||||
$this->value = (int) ($this->value / $value);
|
||||
|
|
@ -301,7 +301,7 @@ final class Money implements \Serializable
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function abs() : Money
|
||||
public function abs() : self
|
||||
{
|
||||
$this->value = \abs($this->value);
|
||||
|
||||
|
|
@ -317,7 +317,7 @@ final class Money implements \Serializable
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function pow($value) : Money
|
||||
public function pow($value) : self
|
||||
{
|
||||
if (\is_float($value) || is_int($value)) {
|
||||
$this->value = (int) ($this->value ** $value);
|
||||
|
|
@ -361,7 +361,7 @@ final class Money implements \Serializable
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setInt(int $value) : Money
|
||||
public function setInt(int $value) : self
|
||||
{
|
||||
$this->value = $value;
|
||||
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ final class FileLogger implements LoggerInterface
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function getInstance(string $path = '', bool $verbose = false) : FileLogger
|
||||
public static function getInstance(string $path = '', bool $verbose = false) : self
|
||||
{
|
||||
if (self::$instance === null) {
|
||||
self::$instance = new self($path, $verbose);
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ final class Sphere implements D3ShapeInterface
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function byRadius(float $r) : Sphere
|
||||
public static function byRadius(float $r) : self
|
||||
{
|
||||
return new self($r);
|
||||
}
|
||||
|
|
@ -100,7 +100,7 @@ final class Sphere implements D3ShapeInterface
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function byVolume(float $v) : Sphere
|
||||
public static function byVolume(float $v) : self
|
||||
{
|
||||
return new self(self::getRadiusByVolume($v));
|
||||
}
|
||||
|
|
@ -128,7 +128,7 @@ final class Sphere implements D3ShapeInterface
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function bySurface(float $s) : Sphere
|
||||
public static function bySurface(float $s) : self
|
||||
{
|
||||
return new self(self::getRadiusBySurface($s));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -126,9 +126,9 @@ class Matrix implements \ArrayAccess, \Iterator
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function transpose() : Matrix
|
||||
public function transpose() : self
|
||||
{
|
||||
$matrix = new Matrix($this->n, $this->m);
|
||||
$matrix = new self($this->n, $this->m);
|
||||
$matrix->setMatrix(\array_map(null, ...$this->matrix));
|
||||
|
||||
return $matrix;
|
||||
|
|
@ -158,7 +158,7 @@ class Matrix implements \ArrayAccess, \Iterator
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getSubMatrix(int $iRow, int $lRow, int $iCol, int $lCol) : Matrix
|
||||
public function getSubMatrix(int $iRow, int $lRow, int $iCol, int $lCol) : self
|
||||
{
|
||||
$X = [[]];
|
||||
for ($i = $iRow; $i <= $lRow; ++$i) {
|
||||
|
|
@ -183,7 +183,7 @@ class Matrix implements \ArrayAccess, \Iterator
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getSubMatrixByColumnsRows(array $rows, array $cols) : Matrix
|
||||
public function getSubMatrixByColumnsRows(array $rows, array $cols) : self
|
||||
{
|
||||
$X = [[]];
|
||||
$rlength = \count($rows);
|
||||
|
|
@ -212,7 +212,7 @@ class Matrix implements \ArrayAccess, \Iterator
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getSubMatrixByColumns(int $iRow, int $lRow, array $cols) : Matrix
|
||||
public function getSubMatrixByColumns(int $iRow, int $lRow, array $cols) : self
|
||||
{
|
||||
$X = [[]];
|
||||
$length = \count($cols);
|
||||
|
|
@ -240,7 +240,7 @@ class Matrix implements \ArrayAccess, \Iterator
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getSubMatrixByRows(array $rows, int $iCol, int $lCol) : Matrix
|
||||
public function getSubMatrixByRows(array $rows, int $iCol, int $lCol) : self
|
||||
{
|
||||
$X = [[]];
|
||||
$length = \count($rows);
|
||||
|
|
@ -378,7 +378,7 @@ class Matrix implements \ArrayAccess, \Iterator
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setMatrix(array $matrix) : Matrix
|
||||
public function setMatrix(array $matrix) : self
|
||||
{
|
||||
$this->m = \count($matrix);
|
||||
$this->n = !\is_array($matrix[0] ?? 1) ? 1 : \count($matrix[0]);
|
||||
|
|
@ -398,9 +398,9 @@ class Matrix implements \ArrayAccess, \Iterator
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function sub($value) : Matrix
|
||||
public function sub($value) : self
|
||||
{
|
||||
if ($value instanceof Matrix) {
|
||||
if ($value instanceof self) {
|
||||
return $this->add($value->mult(-1));
|
||||
} elseif (!is_string($value) && is_numeric($value)) {
|
||||
return $this->add(-$value);
|
||||
|
|
@ -420,9 +420,9 @@ class Matrix implements \ArrayAccess, \Iterator
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function add($value) : Matrix
|
||||
public function add($value) : self
|
||||
{
|
||||
if ($value instanceof Matrix) {
|
||||
if ($value instanceof self) {
|
||||
return $this->addMatrix($value);
|
||||
} elseif (!is_string($value) && is_numeric($value)) {
|
||||
return $this->addScalar($value);
|
||||
|
|
@ -442,7 +442,7 @@ class Matrix implements \ArrayAccess, \Iterator
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function addMatrix(Matrix $matrix) : Matrix
|
||||
private function addMatrix(self $matrix) : self
|
||||
{
|
||||
if ($this->m !== $matrix->getM() || $this->n !== $matrix->getN()) {
|
||||
throw new InvalidDimensionException($matrix->getM() . 'x' . $matrix->getN());
|
||||
|
|
@ -457,7 +457,7 @@ class Matrix implements \ArrayAccess, \Iterator
|
|||
}
|
||||
}
|
||||
|
||||
$newMatrix = new Matrix($this->m, $this->n);
|
||||
$newMatrix = new self($this->m, $this->n);
|
||||
$newMatrix->setMatrix($newMatrixArr);
|
||||
|
||||
return $newMatrix;
|
||||
|
|
@ -498,7 +498,7 @@ class Matrix implements \ArrayAccess, \Iterator
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function addScalar($scalar) : Matrix
|
||||
private function addScalar($scalar) : self
|
||||
{
|
||||
$newMatrixArr = $this->matrix;
|
||||
|
||||
|
|
@ -508,7 +508,7 @@ class Matrix implements \ArrayAccess, \Iterator
|
|||
}
|
||||
}
|
||||
|
||||
$newMatrix = new Matrix($this->m, $this->n);
|
||||
$newMatrix = new self($this->m, $this->n);
|
||||
$newMatrix->setMatrix($newMatrixArr);
|
||||
|
||||
return $newMatrix;
|
||||
|
|
@ -525,9 +525,9 @@ class Matrix implements \ArrayAccess, \Iterator
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function mult($value) : Matrix
|
||||
public function mult($value) : self
|
||||
{
|
||||
if ($value instanceof Matrix) {
|
||||
if ($value instanceof self) {
|
||||
return $this->multMatrix($value);
|
||||
} elseif (!is_string($value) && is_numeric($value)) {
|
||||
return $this->multScalar($value);
|
||||
|
|
@ -547,13 +547,13 @@ class Matrix implements \ArrayAccess, \Iterator
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function multMatrix(Matrix $matrix) : Matrix
|
||||
private function multMatrix(self $matrix) : self
|
||||
{
|
||||
$nDim = $matrix->getN();
|
||||
$mDim = $matrix->getM();
|
||||
|
||||
$matrixArr = $matrix->getMatrix();
|
||||
$newMatrix = new Matrix($this->m, $nDim);
|
||||
$newMatrix = new self($this->m, $nDim);
|
||||
$newMatrixArr = $newMatrix->getMatrix();
|
||||
|
||||
for ($i = 0; $i < $this->m; ++$i) { // Row of $this
|
||||
|
|
@ -584,7 +584,7 @@ class Matrix implements \ArrayAccess, \Iterator
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function multScalar($scalar) : Matrix
|
||||
private function multScalar($scalar) : self
|
||||
{
|
||||
$newMatrixArr = $this->matrix;
|
||||
|
||||
|
|
@ -594,7 +594,7 @@ class Matrix implements \ArrayAccess, \Iterator
|
|||
}
|
||||
}
|
||||
|
||||
$newMatrix = new Matrix($this->m, $this->n);
|
||||
$newMatrix = new self($this->m, $this->n);
|
||||
$newMatrix->setMatrix($newMatrixArr);
|
||||
|
||||
return $newMatrix;
|
||||
|
|
@ -607,9 +607,9 @@ class Matrix implements \ArrayAccess, \Iterator
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function upperTriangular() : Matrix
|
||||
public function upperTriangular() : self
|
||||
{
|
||||
$matrix = new Matrix($this->n, $this->n);
|
||||
$matrix = new self($this->n, $this->n);
|
||||
|
||||
$matrixArr = $this->matrix;
|
||||
$this->upperTrianglize($matrixArr);
|
||||
|
|
@ -677,7 +677,7 @@ class Matrix implements \ArrayAccess, \Iterator
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function inverse() : Matrix
|
||||
public function inverse() : self
|
||||
{
|
||||
return $this->solve(new IdentityMatrix($this->m));
|
||||
}
|
||||
|
|
@ -691,7 +691,7 @@ class Matrix implements \ArrayAccess, \Iterator
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function solve(Matrix $B) : Matrix
|
||||
public function solve(self $B) : self
|
||||
{
|
||||
$M = $this->m === $this->n ? new LUDecomposition($this) : new QRDecomposition($this);
|
||||
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ final class Complex
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function conjugate() : Complex
|
||||
public function conjugate() : self
|
||||
{
|
||||
return new self($this->re, -$this->im);
|
||||
}
|
||||
|
|
@ -99,7 +99,7 @@ final class Complex
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function reciprocal() : Complex
|
||||
public function reciprocal() : self
|
||||
{
|
||||
return new self(
|
||||
$this->re / ($this->re ** 2 + $this->im ** 2),
|
||||
|
|
@ -114,7 +114,7 @@ final class Complex
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function sqrt() : Complex
|
||||
public function sqrt() : self
|
||||
{
|
||||
return new self(
|
||||
\sqrt(($this->re + \sqrt($this->re ** 2 + $this->im ** 2)) / 2),
|
||||
|
|
@ -141,25 +141,25 @@ final class Complex
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function square() : Complex
|
||||
public function square() : self
|
||||
{
|
||||
return $this->multComplex($this);
|
||||
}
|
||||
|
||||
public function pow($value) : Complex
|
||||
public function pow($value) : self
|
||||
{
|
||||
if (\is_int($value)) {
|
||||
return $this->powInteger($value);
|
||||
} elseif (\is_numeric($value)) {
|
||||
return $this->powScalar($value);
|
||||
} elseif ($value instanceof Complex) {
|
||||
} elseif ($value instanceof self) {
|
||||
return $this->powComplex($value);
|
||||
}
|
||||
|
||||
throw new \InvalidArgumentException();
|
||||
}
|
||||
|
||||
public function powComplex(Complex $value) : Complex
|
||||
public function powComplex(self $value) : self
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -173,7 +173,7 @@ final class Complex
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function powInteger(int $value) : Complex
|
||||
public function powInteger(int $value) : self
|
||||
{
|
||||
if ($value === 0) {
|
||||
return new self(1, 0);
|
||||
|
|
@ -184,7 +184,7 @@ final class Complex
|
|||
return $this->multComplex($this->powInteger(--$value));
|
||||
}
|
||||
|
||||
public function powScalar($value) : Complex
|
||||
public function powScalar($value) : self
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -200,11 +200,11 @@ final class Complex
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function add($value) : Complex
|
||||
public function add($value) : self
|
||||
{
|
||||
if (\is_numeric($value)) {
|
||||
return $this->addScalar($value);
|
||||
} elseif ($value instanceof Complex) {
|
||||
} elseif ($value instanceof self) {
|
||||
return $this->addComplex($value);
|
||||
}
|
||||
|
||||
|
|
@ -220,7 +220,7 @@ final class Complex
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function addComplex(Complex $cpl) : Complex
|
||||
private function addComplex(self $cpl) : self
|
||||
{
|
||||
return new self($this->re + $cpl->re(), $this->im + $cpl->im());
|
||||
}
|
||||
|
|
@ -234,7 +234,7 @@ final class Complex
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function addScalar($val) : Complex
|
||||
private function addScalar($val) : self
|
||||
{
|
||||
return new self($this->re + $val, $this->im);
|
||||
}
|
||||
|
|
@ -250,11 +250,11 @@ final class Complex
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function sub($value) : Complex
|
||||
public function sub($value) : self
|
||||
{
|
||||
if (\is_numeric($value)) {
|
||||
return $this->subScalar($value);
|
||||
} elseif ($value instanceof Complex) {
|
||||
} elseif ($value instanceof self) {
|
||||
return $this->subComplex($value);
|
||||
}
|
||||
|
||||
|
|
@ -270,7 +270,7 @@ final class Complex
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function subComplex(Complex $cpl) : Complex
|
||||
private function subComplex(self $cpl) : self
|
||||
{
|
||||
return new self($this->re - $cpl->re(), $this->im - $cpl->im());
|
||||
}
|
||||
|
|
@ -284,7 +284,7 @@ final class Complex
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function subScalar($val) : Complex
|
||||
private function subScalar($val) : self
|
||||
{
|
||||
return new self($this->re - $val, $this->im);
|
||||
}
|
||||
|
|
@ -300,11 +300,11 @@ final class Complex
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function mult($value) : Complex
|
||||
public function mult($value) : self
|
||||
{
|
||||
if (\is_numeric($value)) {
|
||||
return $this->multScalar($value);
|
||||
} elseif ($value instanceof Complex) {
|
||||
} elseif ($value instanceof self) {
|
||||
return $this->multComplex($value);
|
||||
}
|
||||
|
||||
|
|
@ -320,7 +320,7 @@ final class Complex
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function multComplex(Complex $cpl) : Complex
|
||||
private function multComplex(self $cpl) : self
|
||||
{
|
||||
return new self(
|
||||
$this->re * $cpl->re() - $this->im * $cpl->im(),
|
||||
|
|
@ -337,7 +337,7 @@ final class Complex
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function multScalar($val) : Complex
|
||||
private function multScalar($val) : self
|
||||
{
|
||||
return new self($this->re * $val, $this->im * $val);
|
||||
}
|
||||
|
|
@ -353,11 +353,11 @@ final class Complex
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function div($value) : Complex
|
||||
public function div($value) : self
|
||||
{
|
||||
if (\is_numeric($value)) {
|
||||
return $this->divScalar($value);
|
||||
} elseif ($value instanceof Complex) {
|
||||
} elseif ($value instanceof self) {
|
||||
return $this->divComplex($value);
|
||||
}
|
||||
|
||||
|
|
@ -373,7 +373,7 @@ final class Complex
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function divComplex(Complex $cpl) : Complex
|
||||
private function divComplex(self $cpl) : self
|
||||
{
|
||||
return new self(
|
||||
($this->re * $cpl->re() + $this->im * $cpl->im()) / ($cpl->re() ** 2 + $cpl->im() ** 2),
|
||||
|
|
@ -390,7 +390,7 @@ final class Complex
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function divScalar($val) : Complex
|
||||
private function divScalar($val) : self
|
||||
{
|
||||
return new self($this->re / $val, $this->im / $val);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ final class Response extends ResponseAbstract implements RenderableInterface
|
|||
FileLogger::MSG_FULL, [
|
||||
'message' => $e->getMessage(),
|
||||
'line' => __LINE__,
|
||||
'file' => Response::class,
|
||||
'file' => self::class,
|
||||
]
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -223,7 +223,7 @@ final class Request extends RequestAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function createFromSuperglobals() : Request
|
||||
public static function createFromSuperglobals() : self
|
||||
{
|
||||
return new self();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ final class Response extends ResponseAbstract implements RenderableInterface
|
|||
FileLogger::MSG_FULL, [
|
||||
'message' => $e->getMessage(),
|
||||
'line' => __LINE__,
|
||||
'file' => Response::class,
|
||||
'file' => self::class,
|
||||
]
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ class SmartDateTime extends \DateTime
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function createFromDateTime(\DateTime $date) : SmartDateTime
|
||||
public static function createFromDateTime(\DateTime $date) : self
|
||||
{
|
||||
return new self($date->format('Y-m-d H:i:s'), $date->getTimezone());
|
||||
}
|
||||
|
|
@ -70,7 +70,7 @@ class SmartDateTime extends \DateTime
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function createModify(int $y, int $m = 0, int $d = 0, int $calendar = CAL_GREGORIAN) : SmartDateTime
|
||||
public function createModify(int $y, int $m = 0, int $d = 0, int $calendar = CAL_GREGORIAN) : self
|
||||
{
|
||||
$dt = clone $this;
|
||||
$dt->smartModify($y, $m, $d, $calendar);
|
||||
|
|
@ -90,7 +90,7 @@ class SmartDateTime extends \DateTime
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function smartModify(int $y, int $m = 0, int $d = 0, int $calendar = CAL_GREGORIAN) : SmartDateTime
|
||||
public function smartModify(int $y, int $m = 0, int $d = 0, int $calendar = CAL_GREGORIAN) : self
|
||||
{
|
||||
$yearChange = (int) floor(((int) $this->format('m') - 1 + $m) / 12);
|
||||
$yearChange = ((int) $this->format('m') - 1 + $m) < 0 && ((int) $this->format('m') - 1 + $m) % 12 === 0 ? $yearChange - 1 : $yearChange;
|
||||
|
|
@ -125,9 +125,9 @@ class SmartDateTime extends \DateTime
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getEndOfMonth() : SmartDateTime
|
||||
public function getEndOfMonth() : self
|
||||
{
|
||||
return new SmartDateTime($this->format('Y') . '-' . $this->format('m') . '-' . $this->getDaysOfMonth());
|
||||
return new self($this->format('Y') . '-' . $this->format('m') . '-' . $this->getDaysOfMonth());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -137,9 +137,9 @@ class SmartDateTime extends \DateTime
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getStartOfMonth() : SmartDateTime
|
||||
public function getStartOfMonth() : self
|
||||
{
|
||||
return new SmartDateTime($this->format('Y') . '-' . $this->format('m') . '-01');
|
||||
return new self($this->format('Y') . '-' . $this->format('m') . '-01');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ namespace phpOMS\Stdlib\Graph;
|
|||
*/
|
||||
class BinaryTree extends Tree
|
||||
{
|
||||
public static function invert($list) : BinaryTree
|
||||
public static function invert($list) : self
|
||||
{
|
||||
if (empty($list->getNodes())) {
|
||||
return $list;
|
||||
|
|
@ -83,7 +83,7 @@ class BinaryTree extends Tree
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setLeft(Node $base, Node $left) : BinaryTree
|
||||
public function setLeft(Node $base, Node $left) : self
|
||||
{
|
||||
if ($this->getLeft($base) === null) {
|
||||
$this->addNodeRelative($base, $left);
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class Graph
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function addNode(Node $node) : Graph
|
||||
public function addNode(Node $node) : self
|
||||
{
|
||||
$this->nodes[] = $node;
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ class Graph
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function addNodeRelative(Node $relative, Node $node) : Graph
|
||||
public function addNodeRelative(Node $relative, Node $node) : self
|
||||
{
|
||||
$this->edges[] = new Edge($relative, $node);
|
||||
|
||||
|
|
@ -83,7 +83,7 @@ class Graph
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setNode($key, Node $node) : Graph
|
||||
public function setNode($key, Node $node) : self
|
||||
{
|
||||
$this->nodes[$key] = $node;
|
||||
|
||||
|
|
@ -99,7 +99,7 @@ class Graph
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function addEdge(Edge $edge) : Graph
|
||||
public function addEdge(Edge $edge) : self
|
||||
{
|
||||
$this->edges[] = $edge;
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ class Tree extends Graph
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function addRelativeNode(Node $base, Node $node) : Tree
|
||||
public function addRelativeNode(Node $base, Node $node) : self
|
||||
{
|
||||
parent::addNode($node);
|
||||
parent::addEdge(new Edge($base, $node));
|
||||
|
|
|
|||
|
|
@ -275,7 +275,7 @@ interface ContainerInterface
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getParent() : ContainerInterface;
|
||||
public function getParent() : self;
|
||||
|
||||
/**
|
||||
* Create resource at destination path.
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ class File extends FileAbstract implements FileInterface
|
|||
$content = '';
|
||||
$con = self::ftpConnect($http);
|
||||
|
||||
if (\ftp_chdir($con, File::dirpath($path)) && \ftp_fget($con, $temp, $path, FTP_BINARY, 0)) {
|
||||
if (\ftp_chdir($con, self::dirpath($path)) && \ftp_fget($con, $temp, $path, FTP_BINARY, 0)) {
|
||||
\rewind($temp);
|
||||
$content = \stream_get_contents($temp);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ abstract class StorageAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
abstract public static function getInstance() : StorageAbstract;
|
||||
abstract public static function getInstance() : self;
|
||||
|
||||
/**
|
||||
* Get the internal class type (directory or file) based on path.
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class Git
|
|||
public static function test() : bool
|
||||
{
|
||||
$pipes = [];
|
||||
$resource = \proc_open(\escapeshellarg(Git::getBin()), [1 => ['pipe', 'w'], 2 => ['pipe', 'w']], $pipes);
|
||||
$resource = \proc_open(\escapeshellarg(self::getBin()), [1 => ['pipe', 'w'], 2 => ['pipe', 'w']], $pipes);
|
||||
|
||||
$stdout = \stream_get_contents($pipes[1]);
|
||||
$stderr = \stream_get_contents($pipes[2]);
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ class ArrayParser
|
|||
public static function parseVariable($value, int $depth = 1) : string
|
||||
{
|
||||
if (\is_array($value)) {
|
||||
return ArrayParser::serializeArray($value, $depth);
|
||||
return self::serializeArray($value, $depth);
|
||||
} elseif (\is_string($value)) {
|
||||
return '\'' . \str_replace('\'', '\\\'', $value) . '\'';
|
||||
} elseif (\is_bool($value)) {
|
||||
|
|
|
|||
|
|
@ -286,5 +286,5 @@ abstract class TaskAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
abstract public static function createWith(array $jobData) : TaskAbstract;
|
||||
abstract public static function createWith(array $jobData) : self;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,55 +59,55 @@ class FileLoggerTest extends \PHPUnit\Framework\TestCase
|
|||
$log->emergency(FileLogger::MSG_FULL, [
|
||||
'message' => 'msg',
|
||||
'line' => 11,
|
||||
'file' => FileLoggerTest::class,
|
||||
'file' => self::class,
|
||||
]);
|
||||
|
||||
$log->alert(FileLogger::MSG_FULL, [
|
||||
'message' => 'msg',
|
||||
'line' => 11,
|
||||
'file' => FileLoggerTest::class,
|
||||
'file' => self::class,
|
||||
]);
|
||||
|
||||
$log->critical(FileLogger::MSG_FULL, [
|
||||
'message' => 'msg',
|
||||
'line' => 11,
|
||||
'file' => FileLoggerTest::class,
|
||||
'file' => self::class,
|
||||
]);
|
||||
|
||||
$log->error(FileLogger::MSG_FULL, [
|
||||
'message' => 'msg',
|
||||
'line' => 11,
|
||||
'file' => FileLoggerTest::class,
|
||||
'file' => self::class,
|
||||
]);
|
||||
|
||||
$log->warning(FileLogger::MSG_FULL, [
|
||||
'message' => 'msg',
|
||||
'line' => 11,
|
||||
'file' => FileLoggerTest::class,
|
||||
'file' => self::class,
|
||||
]);
|
||||
|
||||
$log->notice(FileLogger::MSG_FULL, [
|
||||
'message' => 'msg',
|
||||
'line' => 11,
|
||||
'file' => FileLoggerTest::class,
|
||||
'file' => self::class,
|
||||
]);
|
||||
|
||||
$log->info(FileLogger::MSG_FULL, [
|
||||
'message' => 'msg',
|
||||
'line' => 11,
|
||||
'file' => FileLoggerTest::class,
|
||||
'file' => self::class,
|
||||
]);
|
||||
|
||||
$log->debug(FileLogger::MSG_FULL, [
|
||||
'message' => 'msg',
|
||||
'line' => 11,
|
||||
'file' => FileLoggerTest::class,
|
||||
'file' => self::class,
|
||||
]);
|
||||
|
||||
$log->log(LogLevel::DEBUG, FileLogger::MSG_FULL, [
|
||||
'message' => 'msg',
|
||||
'line' => 11,
|
||||
'file' => FileLoggerTest::class,
|
||||
'file' => self::class,
|
||||
]);
|
||||
|
||||
self::assertEquals(1, $log->countLogs()['emergency'] ?? 0);
|
||||
|
|
@ -127,7 +127,7 @@ class FileLoggerTest extends \PHPUnit\Framework\TestCase
|
|||
$log->console(FileLogger::MSG_FULL, true, [
|
||||
'message' => 'msg',
|
||||
'line' => 11,
|
||||
'file' => FileLoggerTest::class,
|
||||
'file' => self::class,
|
||||
]);
|
||||
$ob = ob_get_clean();
|
||||
self::assertEquals(1, $log->countLogs()['info'] ?? 0);
|
||||
|
|
@ -156,7 +156,7 @@ class FileLoggerTest extends \PHPUnit\Framework\TestCase
|
|||
$log->log('testException', FileLogger::MSG_FULL, [
|
||||
'message' => 'msg',
|
||||
'line' => 11,
|
||||
'file' => FileLoggerTest::class,
|
||||
'file' => self::class,
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user