@@ -18,8 +18,7 @@ |
||
18 | 18 | $return = $val; |
19 | 19 | if (method_exists($val, 'raw')) { |
20 | 20 | $return = $val->raw(); |
21 | - } |
|
22 | - elseif (is_array($val)) { |
|
21 | + } elseif (is_array($val)) { |
|
23 | 22 | $return = array(); |
24 | 23 | foreach ($val as $v) { |
25 | 24 | $return[] = method_exists($v, 'raw') ? $v->raw() : $v; |
@@ -25,6 +25,7 @@ |
||
25 | 25 | * |
26 | 26 | * @param \TheSportsDb\Entity\LeagueInterface $league |
27 | 27 | * The league to add. |
28 | + * @return void |
|
28 | 29 | */ |
29 | 30 | public function addLeague(LeagueInterface $league); |
30 | 31 | } |
@@ -126,7 +126,7 @@ |
||
126 | 126 | * |
127 | 127 | * @return void |
128 | 128 | */ |
129 | - public function sanitizeValues(\stdClass &$values, $entityType); |
|
129 | + public function sanitizeValues(\stdClass & $values, $entityType); |
|
130 | 130 | |
131 | 131 | /** |
132 | 132 | * Check if a value is considered to be empty. |
@@ -330,8 +330,7 @@ |
||
330 | 330 | } |
331 | 331 | $val = $this->factory($propType)->create($val, $propType); |
332 | 332 | } |
333 | - } |
|
334 | - elseif (!($value instanceof EntityInterface)) { |
|
333 | + } elseif (!($value instanceof EntityInterface)) { |
|
335 | 334 | $value = $this->factory($propType)->create($value, $propType); |
336 | 335 | } |
337 | 336 | } |
@@ -95,7 +95,7 @@ |
||
95 | 95 | * |
96 | 96 | * @return void |
97 | 97 | */ |
98 | - public function sanitizeProperty(\stdClass &$object, FactoryContainerInterface $factoryContainer) { |
|
98 | + public function sanitizeProperty(\stdClass & $object, FactoryContainerInterface $factoryContainer) { |
|
99 | 99 | if (($entityType = $this->getEntityType()) && isset($object->{$this->getName()})) { |
100 | 100 | $value = &$object->{$this->getName()}; |
101 | 101 | if ($this->isArray()) { |
@@ -307,7 +307,7 @@ |
||
307 | 307 | /** |
308 | 308 | * {@inheritdoc} |
309 | 309 | */ |
310 | - public function sanitizeValues(\stdClass &$values, $entityType) { |
|
310 | + public function sanitizeValues(\stdClass & $values, $entityType) { |
|
311 | 311 | foreach ($this->getPropertyMapDefinition($entityType)->getPropertyMaps() as $map) { |
312 | 312 | $map->getDestination()->sanitizeProperty($values, $this->factoryContainer); |
313 | 313 | } |
@@ -53,8 +53,7 @@ discard block |
||
53 | 53 | if ($entity instanceof ProxyInterface) { |
54 | 54 | try { |
55 | 55 | $entity->load(); |
56 | - } |
|
57 | - catch (\Exception $e) { |
|
56 | + } catch (\Exception $e) { |
|
58 | 57 | return FALSE; |
59 | 58 | } |
60 | 59 | } |
@@ -85,8 +84,7 @@ discard block |
||
85 | 84 | if ($entity instanceof ProxyInterface) { |
86 | 85 | try { |
87 | 86 | $entity->load(); |
88 | - } |
|
89 | - catch (\Exception $e) { |
|
87 | + } catch (\Exception $e) { |
|
90 | 88 | return FALSE; |
91 | 89 | } |
92 | 90 | } |
@@ -148,8 +146,7 @@ discard block |
||
148 | 146 | if ($entity instanceof ProxyInterface) { |
149 | 147 | try { |
150 | 148 | $entity->load(); |
151 | - } |
|
152 | - catch (\Exception $e) { |
|
149 | + } catch (\Exception $e) { |
|
153 | 150 | return FALSE; |
154 | 151 | } |
155 | 152 | } |
@@ -224,8 +221,7 @@ discard block |
||
224 | 221 | if ($entity instanceof ProxyInterface) { |
225 | 222 | try { |
226 | 223 | $entity->load(); |
227 | - } |
|
228 | - catch (\Exception $e) { |
|
224 | + } catch (\Exception $e) { |
|
229 | 225 | return FALSE; |
230 | 226 | } |
231 | 227 | } |
@@ -300,8 +296,7 @@ discard block |
||
300 | 296 | if ($entity instanceof ProxyInterface) { |
301 | 297 | try { |
302 | 298 | $entity->load(); |
303 | - } |
|
304 | - catch (\Exception $e) { |
|
299 | + } catch (\Exception $e) { |
|
305 | 300 | return FALSE; |
306 | 301 | } |
307 | 302 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | * @param array $contextPropertyMap |
180 | 180 | * Extra properties to map from the context |
181 | 181 | * |
182 | - * @return array |
|
182 | + * @return string |
|
183 | 183 | * An array with following keys: |
184 | 184 | * - object: The raw data representing the entity. |
185 | 185 | * - id: The id of the entity. |
@@ -217,6 +217,9 @@ discard block |
||
217 | 217 | return $date; |
218 | 218 | } |
219 | 219 | |
220 | + /** |
|
221 | + * @param string $format |
|
222 | + */ |
|
220 | 223 | public static function reverseDate(\DateTime $value, $format) { |
221 | 224 | return $value->format($format); |
222 | 225 | } |