1 | <?php |
||
21 | class Joiner implements JoinerContract |
||
22 | { |
||
23 | /** |
||
24 | * Processed query instance. |
||
25 | * |
||
26 | * @var Builder |
||
27 | */ |
||
28 | protected $query; |
||
29 | |||
30 | /** |
||
31 | * Parent model. |
||
32 | * |
||
33 | * @var Model |
||
34 | */ |
||
35 | protected $model; |
||
36 | |||
37 | /** |
||
38 | * Create new joiner instance. |
||
39 | * |
||
40 | * @param Builder $query |
||
41 | * @param Model $model |
||
42 | */ |
||
43 | public function __construct(Builder $query, Model $model) |
||
48 | |||
49 | /** |
||
50 | * Join related tables. |
||
51 | * |
||
52 | * @param string $target |
||
53 | * @param string $type |
||
54 | * @return Model |
||
55 | */ |
||
56 | public function join($target, $type = 'inner') |
||
66 | |||
67 | /** |
||
68 | * Left join related tables. |
||
69 | * |
||
70 | * @param string $target |
||
71 | * @return Model |
||
72 | */ |
||
73 | public function leftJoin($target) |
||
77 | |||
78 | /** |
||
79 | * Right join related tables. |
||
80 | * |
||
81 | * @param string $target |
||
82 | * @return Model |
||
83 | */ |
||
84 | public function rightJoin($target) |
||
88 | |||
89 | /** |
||
90 | * Join relation's table accordingly. |
||
91 | * |
||
92 | * @param Model $parent |
||
93 | * @param string $segment |
||
94 | * @param string $type |
||
95 | * @return Model |
||
96 | */ |
||
97 | protected function joinSegment(Model $parent, $segment, $type) |
||
113 | |||
114 | /** |
||
115 | * Determine whether the related table has been already joined. |
||
116 | * |
||
117 | * @param Join $join |
||
118 | * @return bool |
||
119 | */ |
||
120 | protected function alreadyJoined(Join $join) |
||
124 | |||
125 | /** |
||
126 | * Get the join clause for related table. |
||
127 | * |
||
128 | * @param Model $parent |
||
129 | * @param Relation $relation |
||
130 | * @param string $type |
||
131 | * @param string $table |
||
132 | * @return Join |
||
133 | */ |
||
134 | protected function getJoinClause(Model $parent, Relation $relation, $table, $type) |
||
154 | |||
155 | /** |
||
156 | * Join pivot or 'through' table. |
||
157 | * |
||
158 | * @param Model $parent |
||
159 | * @param Relation $relation |
||
160 | * @param string $type |
||
161 | * @return void |
||
162 | */ |
||
163 | protected function joinIntermediate(Model $parent, Relation $relation, $type) |
||
179 | |||
180 | /** |
||
181 | * Get pair of the keys from relation in order to join the table. |
||
182 | * |
||
183 | * @param Relation $relation |
||
184 | * @return array |
||
185 | * |
||
186 | * @throws LogicException |
||
187 | */ |
||
188 | protected function getJoinKeys(Relation $relation) |
||
212 | } |
||
213 |
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.