@@ -476,7 +476,7 @@ discard block |
||
| 476 | 476 | return self::fromIterable( |
| 477 | 477 | new ArrayCacheIterator( |
| 478 | 478 | new ClosureIterator( |
| 479 | - static function (Generator $generator): Generator { |
|
| 479 | + static function(Generator $generator): Generator { |
|
| 480 | 480 | while ($generator->valid()) { |
| 481 | 481 | yield $generator->key() => $generator->current(); |
| 482 | 482 | $generator->next(); |
@@ -666,9 +666,9 @@ discard block |
||
| 666 | 666 | return new self(MapN::of()(...$callbacks), [$this->getIterator()]); |
| 667 | 667 | } |
| 668 | 668 | |
| 669 | - public function match(callable $callback, ?callable $matcher = null): bool |
|
| 669 | + public function match(callable $callback, ?callable $matcher = null) : bool |
|
| 670 | 670 | { |
| 671 | - return (new self(MatchOne::of()($matcher ?? static fn (): bool => true)($callback), [$this->getIterator()])) |
|
| 671 | + return (new self(MatchOne::of()($matcher ?? static fn () : bool => true)($callback), [$this->getIterator()])) |
|
| 672 | 672 | ->getIterator() |
| 673 | 673 | ->current(); |
| 674 | 674 | } |
@@ -720,7 +720,7 @@ discard block |
||
| 720 | 720 | /** |
| 721 | 721 | * @param array{0: (Closure(Iterator<TKey, T>): Generator<TKey, T>), 1: (array{0: Iterator<TKey, T>})} $partitionResult |
| 722 | 722 | */ |
| 723 | - static function (array $partitionResult): CollectionInterface { |
|
| 723 | + static function(array $partitionResult): CollectionInterface { |
|
| 724 | 724 | /** |
| 725 | 725 | * @var Closure(Iterator<TKey, T>): Generator<TKey, T> $callback |
| 726 | 726 | * @var array{0: Iterator<TKey, T>} $parameters |
@@ -802,12 +802,12 @@ discard block |
||
| 802 | 802 | * |
| 803 | 803 | * @return Closure(T, TKey): bool |
| 804 | 804 | */ |
| 805 | - static fn ($leftValue, $leftKey): Closure => |
|
| 805 | + static fn ($leftValue, $leftKey) : Closure => |
|
| 806 | 806 | /** |
| 807 | 807 | * @param T $rightValue |
| 808 | 808 | * @param TKey $rightKey |
| 809 | 809 | */ |
| 810 | - static fn ($rightValue, $rightKey): bool => $leftValue === $rightValue && $leftKey === $rightKey; |
|
| 810 | + static fn ($rightValue, $rightKey) : bool => $leftValue === $rightValue && $leftKey === $rightKey; |
|
| 811 | 811 | |
| 812 | 812 | return (new self(Same::of()($other->getIterator())($comparatorCallback), [$this->getIterator()]))->getIterator()->current(); |
| 813 | 813 | } |
@@ -869,7 +869,7 @@ discard block |
||
| 869 | 869 | /** |
| 870 | 870 | * @param array{0: (Closure(Iterator<TKey, T>): Generator<TKey, T>), 1: (array{0: Iterator<TKey, T>})} $spanResult |
| 871 | 871 | */ |
| 872 | - static function (array $spanResult): CollectionInterface { |
|
| 872 | + static function(array $spanResult): CollectionInterface { |
|
| 873 | 873 | /** |
| 874 | 874 | * @var Closure(Iterator<TKey, T>): Generator<TKey, T> $callback |
| 875 | 875 | * @var array{0: Iterator<TKey, T>} $parameters |
@@ -980,7 +980,7 @@ discard block |
||
| 980 | 980 | * |
| 981 | 981 | * @return iterable<TKey, T> |
| 982 | 982 | */ |
| 983 | - static fn (Iterator $collection): iterable => $collection; |
|
| 983 | + static fn (Iterator $collection) : iterable => $collection; |
|
| 984 | 984 | |
| 985 | 985 | return new self(When::of()($predicate)($whenTrue)($whenFalse), [$this->getIterator()]); |
| 986 | 986 | } |
@@ -66,22 +66,22 @@ |
||
| 66 | 66 | if (preg_match('/[A-Z]/', $key)) { |
| 67 | 67 | $parts = preg_split('/(?=[A-Z])/', $key, -1, PREG_SPLIT_NO_EMPTY); |
| 68 | 68 | if (strtolower($parts[0]) == 'own') { |
| 69 | - if (strtolower($parts[2]) == 'list') { |
|
| 70 | - return Database::getInstance()->find(strtolower($parts[1]))->where($this->getName() . '_id = ' . $this->_id)->get(); |
|
| 69 | + if (strtolower($parts[2]) == 'list') { |
|
| 70 | + return Database::getInstance()->find(strtolower($parts[1]))->where($this->getName().'_id = '.$this->_id)->get(); |
|
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | if (strtolower($parts[0]) == 'shared') { |
| 74 | - if (strtolower($parts[2]) == 'list') { |
|
| 74 | + if (strtolower($parts[2]) == 'list') { |
|
| 75 | 75 | $rel_table = Database::getInstance()->getTableManager()->tableExists($this->table.'_'.strtolower($parts[1])) ? $this->table.'_'.strtolower($parts[1]) : strtolower($parts[1]).'_'.$this->table; |
| 76 | 76 | print('table: '.$rel_table); |
| 77 | - $relations = Database::getInstance()->find($rel_table)->where($this->getName() . '_id = ' . $this->_id)->get(); |
|
| 77 | + $relations = Database::getInstance()->find($rel_table)->where($this->getName().'_id = '.$this->_id)->get(); |
|
| 78 | 78 | $rel_ids = []; |
| 79 | 79 | foreach ($relations as $relation) { |
| 80 | - $key = strtolower($parts[1]) . '_id'; |
|
| 80 | + $key = strtolower($parts[1]).'_id'; |
|
| 81 | 81 | array_push($rel_ids, $relation->$key); |
| 82 | 82 | } |
| 83 | 83 | print('near return'); |
| 84 | - return Database::getInstance()->find(strtolower($parts[1]))->where('id IN (' . implode(',', $rel_ids) . ')')->get(); |
|
| 84 | + return Database::getInstance()->find(strtolower($parts[1]))->where('id IN ('.implode(',', $rel_ids).')')->get(); |
|
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | } |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * @param array $params |
| 31 | 31 | * @return integer |
| 32 | 32 | */ |
| 33 | - public function exec(string $sql, array $params=array()): int |
|
| 33 | + public function exec(string $sql, array $params = array()): int |
|
| 34 | 34 | { |
| 35 | 35 | return $this->connection->executeStatement($sql, $params); |
| 36 | 36 | } |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | * @param array $params |
| 43 | 43 | * @return array |
| 44 | 44 | */ |
| 45 | - public function getAll(string $sql, array $params=[]): array |
|
| 45 | + public function getAll(string $sql, array $params = []): array |
|
| 46 | 46 | { |
| 47 | 47 | return $this->connection->executeQuery($sql, $params)->fetchAllAssociative(); |
| 48 | 48 | } |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | * @param integer|null $id |
| 230 | 230 | * @return mixed |
| 231 | 231 | */ |
| 232 | - public function get(String $table, int $id=null) : mixed |
|
| 232 | + public function get(String $table, int $id = null) : mixed |
|
| 233 | 233 | { |
| 234 | 234 | if (is_null($id)) { |
| 235 | 235 | return $this->recordManager->getAll($table); |
@@ -62,18 +62,18 @@ |
||
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | /** |
| 65 | - * Get single record by id |
|
| 66 | - * |
|
| 67 | - * @param \Scrawler\Arca\Model $model |
|
| 68 | - * @return \Scrawler\Arca\Model |
|
| 69 | - */ |
|
| 65 | + * Get single record by id |
|
| 66 | + * |
|
| 67 | + * @param \Scrawler\Arca\Model $model |
|
| 68 | + * @return \Scrawler\Arca\Model |
|
| 69 | + */ |
|
| 70 | 70 | public function getById(Model $model, int $id): Model |
| 71 | 71 | { |
| 72 | 72 | $query = $this |
| 73 | - ->queryBuilder |
|
| 74 | - ->select('*') |
|
| 75 | - ->from($model->getName(), 't') |
|
| 76 | - ->where('t.id = '.$id); |
|
| 73 | + ->queryBuilder |
|
| 74 | + ->select('*') |
|
| 75 | + ->from($model->getName(), 't') |
|
| 76 | + ->where('t.id = '.$id); |
|
| 77 | 77 | $result = $this->db->connection->query($query)->fetchAssociative(); |
| 78 | 78 | $model->setProperties($result)->setLoaded(); |
| 79 | 79 | return $model; |