| Total Complexity | 7 |
| Total Lines | 40 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | trait RecordTrait |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @return mixed |
||
| 13 | */ |
||
| 14 | 10 | public function getPrimaryKey() |
|
| 15 | { |
||
| 16 | 10 | $primaryKey = $this->getManager()->getPrimaryKey(); |
|
|
|
|||
| 17 | |||
| 18 | 10 | if (is_array($primaryKey)) { |
|
| 19 | 2 | return $this->generateCompositePrimaryKey($primaryKey); |
|
| 20 | } |
||
| 21 | |||
| 22 | 8 | return $this->{$primaryKey}; |
|
| 23 | } |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @param null $primaryKey |
||
| 27 | * @return array |
||
| 28 | */ |
||
| 29 | 2 | protected function generateCompositePrimaryKey($primaryKey = null) |
|
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @return bool |
||
| 41 | */ |
||
| 42 | 1 | public function hasPrimaryKey() |
|
| 49 | } |
||
| 50 | } |
||
| 51 |