setValues($values); } /** * Gets the keys for all the properties of this object. * * @return array */ public function getPropertyKeys() { return ['values']; } /** * Sets entities for this data source. * * @param MetadataDataEntry[]|array[] $values * * @throws InvalidArgumentException */ public function setValues(array $values) { $this->values = []; foreach ($values as $value) { if ($value instanceof MetadataDataEntry) { $this->values[] = $value; } elseif (is_array($value) && isset($value['value'])) { $this->values[] = new MetadataDataEntry( $value['value'], isset($value['external_id']) ? $value['external_id'] : null ); } else { throw new InvalidArgumentException('The specified metadata datasource values are not valid.'); } } } /** * Gets entities of this data source. * * @return MetadataDataEntry[] */ public function getValues() { return $this->values; } }