@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * @param mixed $default |
| 94 | 94 | * @return mixed |
| 95 | 95 | */ |
| 96 | - public function getProperty( $property, $default = null) |
|
| 96 | + public function getProperty( $property, $default = null ) |
|
| 97 | 97 | { |
| 98 | 98 | return $this->properties[$property] ?? $default; |
| 99 | 99 | } |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | */ |
| 162 | 162 | public function offsetUnset( $offset ) |
| 163 | 163 | { |
| 164 | - unset( $this->properties[$offset] ); |
|
| 164 | + unset($this->properties[$offset]); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | /** |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | */ |
| 172 | 172 | public function setProperty( $property, $value ) |
| 173 | 173 | { |
| 174 | - if( !in_array( $property, $this->allowed )) { |
|
| 174 | + if( !in_array( $property, $this->allowed ) ) { |
|
| 175 | 175 | glsr_log()->error( 'Invalid schema property ('.$property.') for '.$this->getType() ); |
| 176 | 176 | return $this; |
| 177 | 177 | } |
@@ -206,16 +206,16 @@ discard block |
||
| 206 | 206 | */ |
| 207 | 207 | protected function getParents( $parents = null ) |
| 208 | 208 | { |
| 209 | - if( !isset( $parents )) { |
|
| 209 | + if( !isset($parents) ) { |
|
| 210 | 210 | $parents = $this->parents; |
| 211 | 211 | } |
| 212 | 212 | $newParents = $parents; |
| 213 | 213 | foreach( $parents as $parent ) { |
| 214 | 214 | $parentClass = glsr( Helper::class )->buildClassName( $parent, __NAMESPACE__ ); |
| 215 | - if( !class_exists( $parentClass ))continue; |
|
| 216 | - $newParents = array_merge( $newParents, $this->getParents( (new $parentClass)->parents )); |
|
| 215 | + if( !class_exists( $parentClass ) )continue; |
|
| 216 | + $newParents = array_merge( $newParents, $this->getParents( (new $parentClass)->parents ) ); |
|
| 217 | 217 | } |
| 218 | - return array_values( array_unique( $newParents )); |
|
| 218 | + return array_values( array_unique( $newParents ) ); |
|
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | /** |
@@ -226,8 +226,8 @@ discard block |
||
| 226 | 226 | $parents = $this->getParents(); |
| 227 | 227 | foreach( $parents as $parent ) { |
| 228 | 228 | $parentClass = glsr( Helper::class )->buildClassName( $parent, __NAMESPACE__ ); |
| 229 | - if( !class_exists( $parentClass ))continue; |
|
| 230 | - $this->allowed = array_values( array_unique( array_merge( (new $parentClass)->allowed, $this->allowed ))); |
|
| 229 | + if( !class_exists( $parentClass ) )continue; |
|
| 230 | + $this->allowed = array_values( array_unique( array_merge( (new $parentClass)->allowed, $this->allowed ) ) ); |
|
| 231 | 231 | } |
| 232 | 232 | } |
| 233 | 233 | |
@@ -237,17 +237,17 @@ discard block |
||
| 237 | 237 | */ |
| 238 | 238 | protected function serializeProperty( $property ) |
| 239 | 239 | { |
| 240 | - if( is_array( $property )) { |
|
| 240 | + if( is_array( $property ) ) { |
|
| 241 | 241 | return array_map( [$this, 'serializeProperty'], $property ); |
| 242 | 242 | } |
| 243 | 243 | if( $property instanceof Type ) { |
| 244 | 244 | $property = $property->toArray(); |
| 245 | - unset( $property['@context'] ); |
|
| 245 | + unset($property['@context']); |
|
| 246 | 246 | } |
| 247 | 247 | if( $property instanceof DateTimeInterface ) { |
| 248 | 248 | $property = $property->format( DateTime::ATOM ); |
| 249 | 249 | } |
| 250 | - if( is_object( $property )) { |
|
| 250 | + if( is_object( $property ) ) { |
|
| 251 | 251 | throw new InvalidProperty(); |
| 252 | 252 | } |
| 253 | 253 | return $property; |
@@ -212,7 +212,9 @@ discard block |
||
| 212 | 212 | $newParents = $parents; |
| 213 | 213 | foreach( $parents as $parent ) { |
| 214 | 214 | $parentClass = glsr( Helper::class )->buildClassName( $parent, __NAMESPACE__ ); |
| 215 | - if( !class_exists( $parentClass ))continue; |
|
| 215 | + if( !class_exists( $parentClass )) { |
|
| 216 | + continue; |
|
| 217 | + } |
|
| 216 | 218 | $newParents = array_merge( $newParents, $this->getParents( (new $parentClass)->parents )); |
| 217 | 219 | } |
| 218 | 220 | return array_values( array_unique( $newParents )); |
@@ -226,7 +228,9 @@ discard block |
||
| 226 | 228 | $parents = $this->getParents(); |
| 227 | 229 | foreach( $parents as $parent ) { |
| 228 | 230 | $parentClass = glsr( Helper::class )->buildClassName( $parent, __NAMESPACE__ ); |
| 229 | - if( !class_exists( $parentClass ))continue; |
|
| 231 | + if( !class_exists( $parentClass )) { |
|
| 232 | + continue; |
|
| 233 | + } |
|
| 230 | 234 | $this->allowed = array_values( array_unique( array_merge( (new $parentClass)->allowed, $this->allowed ))); |
| 231 | 235 | } |
| 232 | 236 | } |