| | |
| | | public function setAdditionalProperty(PropertyValue|array $additionalProperty):void |
| | | { |
| | | if (is_array($additionalProperty)) { |
| | | if (!is_numeric(array_key_first($additionalProperty))) { |
| | | $additionalProperty = [$additionalProperty]; |
| | | } |
| | | $additionalProperty = array_map(function($property) { |
| | | if (!array_key_exists('type', $property)) { |
| | | $property['type'] = 'JVBase\managers\SEO\render\Thing\Intangible\StructuredValue\PropertyValue'; |
| | | } |
| | | return $property; |
| | | }, $additionalProperty); |
| | | $additionalProperty = $this->classArray('additionalProperty', $additionalProperty, 'JVBase\managers\SEO\render\Thing\Intangible\StructuredValue\PropertyValue'); |
| | | |
| | | $additionalProperty = array_filter($additionalProperty, function ($property) { |
| | | return property_exists($property, 'value') && !empty($property->value); |
| | | }); |
| | | } |
| | | if (!empty($this->additionalProperty)) { |
| | | if (!is_array($this->additionalProperty)) { |
| | | $this->additionalProperty = [$this->additionalProperty]; |
| | | } |
| | | $additionalProperty = array_merge($this->additionalProperty, $additionalProperty); |
| | | } |
| | | $this->additionalProperty = $additionalProperty; |
| | | } |