Back to Feed class

Method offsetSet

public bool
offsetSet
(mixed $offset, mixed $value)
Assigns a value to the specified offset.
Parameters
  • mixed $offset The offset to assign the value to.
  • \Joomla\CMS\Feed\FeedEntry $value The JFeedEntry to set.
Returns
  • bool
Since
  • 3.1.4
-
  • \Joomla\CMS\Feed\ArrayAccess::offsetSet()
  • \InvalidArgumentException
Class: Feed
Project: Joomla

Method offsetSet - Source code

/**
 * Assigns a value to the specified offset.
 *
 * @param   mixed      $offset  The offset to assign the value to.
 * @param   FeedEntry  $value   The JFeedEntry to set.
 *
 * @return  boolean
 *
 * @see     ArrayAccess::offsetSet()
 * @since   3.1.4
 * @throws  \InvalidArgumentException
 */
#[\ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
    if (!$value instanceof FeedEntry) {
        throw new \InvalidArgumentException(sprintf('%1$s entries must be an instance of Joomla\\CMS\\Feed\\FeedPerson. %2$s given.', \get_class($this), \gettype($value) === 'object' ? \get_class($value) : \gettype($value)));
    }
    $this->entries[$offset] = $value;
    return true;
}