Eko\FeedBundle\Formatter\Formatter::__construct PHP Метод

__construct() публичный Метод

Construct a formatter with given feed.
public __construct ( Symfony\Component\Translation\TranslatorInterface $translator, string | null $domain = null )
$translator Symfony\Component\Translation\TranslatorInterface A Symfony translator service instance
$domain string | null A Symfony translation domain
    public function __construct(TranslatorInterface $translator, $domain = null)
    {
        $this->translator = $translator;
        $this->domain = $domain;
    }

Usage Example

Пример #1
0
 /**
  * Construct a formatter with given feed
  *
  * @param Feed $feed A feed instance
  */
 public function __construct(Feed $feed)
 {
     $this->fields = array(new Field('id', 'getFeedItemLink', array('cdata' => false)), new Field('title', 'getFeedItemTitle', array('cdata' => true)), new Field('summary', 'getFeedItemDescription', array('cdata' => true)), new Field('link', 'getFeedItemLink', array('attribute' => true, 'attribute_name' => 'href')), new Field('updated', 'getFeedItemPubDate', array('date_format' => \DateTime::ATOM)));
     $author = $feed->get('author');
     if (empty($author)) {
         throw new \InvalidArgumentException('Atom formatter requires an "author" parameter in configuration.');
     }
     parent::__construct($feed);
     $this->initialize();
 }
All Usage Examples Of Eko\FeedBundle\Formatter\Formatter::__construct