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