Total Complexity | 4 |
Total Lines | 57 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | class Mixed extends Wrappable implements MixedInterface |
||
16 | { |
||
17 | /** |
||
18 | * @var \Rougin\Windstorm\ChildInterface[] |
||
19 | */ |
||
20 | protected $children = array(); |
||
21 | |||
22 | /** |
||
23 | * @var string |
||
24 | */ |
||
25 | protected $primary; |
||
26 | |||
27 | /** |
||
28 | * Initializes the mixed instance. |
||
29 | * |
||
30 | * @param \Rougin\Windstorm\QueryInterface $query |
||
31 | * @param string $primary |
||
32 | */ |
||
33 | public function __construct(QueryInterface $query, $primary) |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * Creates a new child instance and adds it to its children. |
||
42 | * |
||
43 | * @param \Rougin\Windstorm\ChildInterface $child |
||
44 | * @param string $field |
||
45 | * @return self |
||
46 | */ |
||
47 | public function add(ChildInterface $child, $field) |
||
52 | } |
||
53 | |||
54 | /** |
||
55 | * Returns all added child instances. |
||
56 | * |
||
57 | * @return \Rougin\Windstorm\ChildInterface[] |
||
58 | */ |
||
59 | public function all() |
||
60 | { |
||
61 | return $this->children; |
||
62 | } |
||
63 | |||
64 | /** |
||
65 | * Returns the primary key of the parent table. |
||
66 | * |
||
67 | * @return string |
||
68 | */ |
||
69 | public function primary() |
||
72 | } |
||
73 | } |
||
74 |