/**
* Magic method to set values for feed properties.
*
* @param string $name The name of the property.
* @param mixed $value The value to set for the property.
*
* @return void
*
* @since 3.1.4
*/
public function __set($name, $value)
{
// Ensure that setting a date always sets a Date instance.
if (($name === 'updatedDate' || $name === 'publishedDate') && !$value instanceof Date) {
$value = new Date($value);
}
// Validate that any authors that are set are instances of JFeedPerson or null.
if ($name === 'author' && (!$value instanceof FeedPerson || $value === null)) {
throw new \InvalidArgumentException(sprintf('%1$s "author" must be an instance of Joomla\\CMS\\Feed\\FeedPerson. %2$s given.', \get_class($this), \gettype($value) === 'object' ? \get_class($value) : \gettype($value)));
}
// Validate that any sources that are set are instances of JFeed or null.
if ($name === 'source' && (!$value instanceof Feed || $value === null)) {
throw new \InvalidArgumentException(sprintf('%1$s "source" must be an instance of Joomla\\CMS\\Feed\\Feed. %2$s given.', \get_class($this), \gettype($value) === 'object' ? \get_class($value) : \gettype($value)));
}
// Disallow setting categories, contributors, or links directly.
if (\in_array($name, array('categories', 'contributors', 'links'))) {
throw new \InvalidArgumentException(sprintf('Cannot directly set %1$s property "%2$s".', \get_class($this), $name));
}
$this->properties[$name] = $value;
}