@@ -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 | } |
@@ -162,7 +162,7 @@ |
||
| 162 | 162 | * @param array $contextPropertyMap |
| 163 | 163 | * Extra properties to map from the context |
| 164 | 164 | * |
| 165 | - * @return array |
|
| 165 | + * @return string |
|
| 166 | 166 | * An array with following keys: |
| 167 | 167 | * - object: The raw data representing the entity. |
| 168 | 168 | * - id: The id of the entity. |
@@ -84,7 +84,7 @@ |
||
| 84 | 84 | * {@inheritdoc} |
| 85 | 85 | */ |
| 86 | 86 | public static function getPropertyMapDefinition() { |
| 87 | - if (!isset(static::$propertyMapDefinition)) { |
|
| 87 | + if (!isset(static::$propertyMapDefinition)) { |
|
| 88 | 88 | static::$propertyMapDefinition = new PropertyMapDefinition(); |
| 89 | 89 | static::initPropertyMapDefinition(); |
| 90 | 90 | } |
@@ -21,6 +21,10 @@ |
||
| 21 | 21 | |
| 22 | 22 | protected $isArray; |
| 23 | 23 | |
| 24 | + /** |
|
| 25 | + * @param string $name |
|
| 26 | + * @param string $entityType |
|
| 27 | + */ |
|
| 24 | 28 | public function __construct($name, $entityType = NULL, $isArray = FALSE) { |
| 25 | 29 | $this->name = $name; |
| 26 | 30 | $this->entityType = $entityType; |
@@ -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. |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | /** |
| 305 | 305 | * {@inheritdoc} |
| 306 | 306 | */ |
| 307 | - public function sanitizeValues(\stdClass &$values, $entityType) { |
|
| 307 | + public function sanitizeValues(\stdClass & $values, $entityType) { |
|
| 308 | 308 | foreach ($this->getPropertyMapDefinition($entityType)->getPropertyMaps() as $map) { |
| 309 | 309 | $this->sanitizeProperty($values, $map->getDestination()); |
| 310 | 310 | } |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | * |
| 321 | 321 | * @return void |
| 322 | 322 | */ |
| 323 | - protected function sanitizeProperty(\stdClass &$object, PropertyDefinition $property) { |
|
| 323 | + protected function sanitizeProperty(\stdClass & $object, PropertyDefinition $property) { |
|
| 324 | 324 | if (($propType = $property->getEntityType()) && isset($object->{$property->getName()})) { |
| 325 | 325 | $value = &$object->{$property->getName()}; |
| 326 | 326 | if ($property->isArray()) { |
@@ -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 | } |