| Total Complexity | 4 |
| Total Lines | 53 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | trait HasRelationships |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * The "relationships" member |
||
| 16 | * |
||
| 17 | * @var array An array of RelationshipFactory |
||
| 18 | */ |
||
| 19 | protected $relationships; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * Get the relationships collection |
||
| 23 | * |
||
| 24 | * @return array|null |
||
| 25 | */ |
||
| 26 | 9 | public function getRelationships(): ?array |
|
| 27 | { |
||
| 28 | 9 | return $this->relationships; |
|
| 29 | } |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Add a single relationship |
||
| 33 | * |
||
| 34 | * @param string $name |
||
| 35 | * @param RelationshipContract $relationship |
||
| 36 | * |
||
| 37 | * @return static |
||
| 38 | */ |
||
| 39 | 27 | public function addRelationship(string $name, $relationship) |
|
| 44 | } |
||
| 45 | |||
| 46 | /** |
||
| 47 | * Fill the "relationships" member with fake values. |
||
| 48 | * |
||
| 49 | * @param integer $count The number of relationships to generate. |
||
| 50 | * |
||
| 51 | * @return static |
||
| 52 | */ |
||
| 53 | 18 | public function fakeRelationships($count = 2) |
|
| 67 |