Back to RssParser class

Method processPerson

protected \Joomla\CMS\Feed\FeedPerson
processPerson
(mixed $data)
Method to parse a string with person data and return a FeedPerson object.
Parameters
  • string $data The string to parse for a person.
Returns
  • \Joomla\CMS\Feed\FeedPerson
Since
  • 3.1.4
Class: RssParser
Project: Joomla

Method processPerson - Source code

/**
 * Method to parse a string with person data and return a FeedPerson object.
 *
 * @param   string  $data  The string to parse for a person.
 *
 * @return  FeedPerson
 *
 * @since   3.1.4
 */
protected function processPerson($data)
{
    // Create a new person object.
    $person = new FeedPerson();
    // This is really cheap parsing, but so far good enough. :)
    $data = explode(' ', $data, 2);
    if (isset($data[1])) {
        $person->name = trim($this->inputFilter->clean($data[1], 'html'), ' ()');
    }
    // Set the email for the person.
    $person->email = trim(filter_var((string) $data[0], FILTER_VALIDATE_EMAIL));
    return $person;
}