@@ -9,7 +9,9 @@ discard block |
||
9 | 9 | private $siblings = []; |
10 | 10 | |
11 | 11 | public function __construct(\Maphper\Maphper $mapper, $parentField, $localField, array $criteria = []) { |
12 | - if ($criteria) $mapper = $mapper->filter($this->criteira); |
|
12 | + if ($criteria) { |
|
13 | + $mapper = $mapper->filter($this->criteira); |
|
14 | + } |
|
13 | 15 | $this->mapper = $mapper; |
14 | 16 | $this->parentField = $parentField; |
15 | 17 | $this->localField = $localField; |
@@ -29,7 +31,9 @@ discard block |
||
29 | 31 | private function lazyLoad() { |
30 | 32 | if (!isset($this->data)) { |
31 | 33 | |
32 | - if ($this->parentObject == null) throw new \Exception('Error, no object set'); |
|
34 | + if ($this->parentObject == null) { |
|
35 | + throw new \Exception('Error, no object set'); |
|
36 | + } |
|
33 | 37 | |
34 | 38 | $this->eagerLoad(); |
35 | 39 | |
@@ -58,7 +62,9 @@ discard block |
||
58 | 62 | } |
59 | 63 | |
60 | 64 | foreach ($this->siblings as $sibling) { |
61 | - if (isset($cache[$sibling->parentObject->{$this->parentField}])) $sibling->data = $cache[$sibling->parentObject->{$this->parentField}]; |
|
65 | + if (isset($cache[$sibling->parentObject->{$this->parentField}])) { |
|
66 | + $sibling->data = $cache[$sibling->parentObject->{$this->parentField}]; |
|
67 | + } |
|
62 | 68 | } |
63 | 69 | /* |
64 | 70 | foreach ($this->siblings as $sibling) { |
@@ -69,13 +75,18 @@ discard block |
||
69 | 75 | } |
70 | 76 | |
71 | 77 | public function __call($func, array $args = []) { |
72 | - if ($this->lazyLoad() == null) return ''; |
|
78 | + if ($this->lazyLoad() == null) { |
|
79 | + return ''; |
|
80 | + } |
|
73 | 81 | return call_user_func_array([$this->lazyLoad(), $func], $args); |
74 | 82 | } |
75 | 83 | |
76 | 84 | public function __get($name) { |
77 | - if ($this->lazyLoad()) return $this->lazyLoad()->$name; |
|
78 | - else return null; |
|
85 | + if ($this->lazyLoad()) { |
|
86 | + return $this->lazyLoad()->$name; |
|
87 | + } else { |
|
88 | + return null; |
|
89 | + } |
|
79 | 90 | } |
80 | 91 | |
81 | 92 | public function __isset($name) { |