| Total Complexity | 8 |
| Total Lines | 48 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 20 | trait Result |
||
| 21 | { |
||
| 22 | /** |
||
| 23 | * Finds the record by primary key |
||
| 24 | * @inheritDoc |
||
| 25 | */ |
||
| 26 | public function findOne(int $id): object |
||
| 27 | { |
||
| 28 | $result = $this->ormObject->find_one($id); |
||
| 29 | return $result ?: $this->ormObject(); |
||
|
|
|||
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * Finds the record by given column and value |
||
| 34 | * @inheritDoc |
||
| 35 | */ |
||
| 36 | public function findOneBy(string $column, $value): object |
||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * Gets the first item |
||
| 44 | * @inheritDoc |
||
| 45 | */ |
||
| 46 | public function first(): object |
||
| 50 | } |
||
| 51 | |||
| 52 | /** |
||
| 53 | * Counts the result set |
||
| 54 | * @inheritDoc |
||
| 55 | */ |
||
| 56 | public function count(): int |
||
| 57 | { |
||
| 58 | return $this->ormObject->count(); |
||
| 59 | } |
||
| 60 | |||
| 61 | /** |
||
| 62 | * Returns the result as array |
||
| 63 | * @inheritDoc |
||
| 64 | */ |
||
| 65 | public function asArray(): array |
||
| 68 | } |
||
| 69 | |||
| 70 | } |