@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | throw new \Exception("Query method is not implemented for MongDB"); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - public function one(string $collection_name, array $conditions, array $options = []): ?array |
|
| 81 | + public function one(string $collection_name, array $conditions, array $options = []): ? array |
|
| 82 | 82 | { |
| 83 | 83 | $collection = $this->collection($collection_name); |
| 84 | 84 | $conditions = $this->idReplaceConditions($conditions); |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | return $result->getModifiedCount() ?? 0; |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - public function insert(string $collection, array $data, array $options = []): ?ObjectID |
|
| 132 | + public function insert(string $collection, array $data, array $options = []): ? ObjectID |
|
| 133 | 133 | { |
| 134 | 134 | $collection = $this->collection($collection); |
| 135 | 135 | $result = $collection->insertOne($data, $options); |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | return $result->fetchAll(PDO::FETCH_ASSOC); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - public function one(string $table, array $conditions, array $options = []): ?array |
|
| 64 | + public function one(string $table, array $conditions, array $options = []): ? array |
|
| 65 | 65 | { |
| 66 | 66 | $result = $this->find($table, $conditions, $options); |
| 67 | 67 | $result = iterator_to_array($result); |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | if (empty($conditions)) { |
| 107 | 107 | return ""; |
| 108 | 108 | } |
| 109 | - $fun = function ($o, $v) { |
|
| 109 | + $fun = function($o, $v) { |
|
| 110 | 110 | return "{$o}{$v} = :c_{$v}"; |
| 111 | 111 | }; |
| 112 | 112 | $where = array_reduce(array_keys($conditions), $fun, ""); |
@@ -171,13 +171,13 @@ discard block |
||
| 171 | 171 | |
| 172 | 172 | private function data(array $data): string |
| 173 | 173 | { |
| 174 | - $fun = function ($o, $v) { |
|
| 174 | + $fun = function($o, $v) { |
|
| 175 | 175 | return "{$o}{$v} = :d_{$v}"; |
| 176 | 176 | }; |
| 177 | 177 | return (string)array_reduce(array_keys($data), $fun, ""); |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - public function insert(string $table, array $data, array $options = []): ?string |
|
| 180 | + public function insert(string $table, array $data, array $options = []): ? string |
|
| 181 | 181 | { |
| 182 | 182 | $keys = implode(', ', array_keys($data)); |
| 183 | 183 | $data_phs = ':d_' . implode(', :d_', array_keys($data)); |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | unset($options['with']); |
| 79 | 79 | $result = static::db()->find(static::table(), $conditions, $options); |
| 80 | 80 | $pk = static::pk(); |
| 81 | - $gen = function () use ($result, $pk, $with) { |
|
| 81 | + $gen = function() use ($result, $pk, $with) { |
|
| 82 | 82 | foreach ($result as $row) { |
| 83 | 83 | $model = new static($row); |
| 84 | 84 | if ($with) { |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | return iterator_to_array($generator); |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - public static function fields(): ?array |
|
| 115 | + public static function fields(): ? array |
|
| 116 | 116 | { |
| 117 | 117 | return isset(static::$fields) ? static::$fields : null; |
| 118 | 118 | } |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | if (empty($fields) === false) { |
| 124 | 124 | $data = array_filter( |
| 125 | 125 | $data, |
| 126 | - function ($key) use ($fields) { |
|
| 126 | + function($key) use ($fields) { |
|
| 127 | 127 | return in_array($key, $fields); |
| 128 | 128 | }, |
| 129 | 129 | ARRAY_FILTER_USE_KEY |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | $this->data = $data; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - abstract public static function fields(): ?array; |
|
| 36 | + abstract public static function fields(): ? array; |
|
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | 39 | * @param $name |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | public function __call(string $method, array $args = []) |
| 48 | 48 | { |
| 49 | - $refresh = (bool) array_shift($args); |
|
| 49 | + $refresh = (bool)array_shift($args); |
|
| 50 | 50 | return $this->getRelatedModel($method, $refresh); |
| 51 | 51 | } |
| 52 | 52 | |