public static function fromSimpleXml($xml, $userId = null)
  {
    $torrent = new NyaaTorrent();
    $torrent->title = (string)$xml->title;
    $torrent->setInfoFromDescription((string)$xml->description);
    $torrent->meta = NyaaMeta::createFromTitle($torrent->title);

    $torrent->torrentUrl = (string)$xml->link;
    $torrent->siteUrl = (string)$xml->guid;
    $torrent->category = (string)$xml->category;
    $torrent->publishDate = \DateTime::createFromFormat('D, d M Y H:i:s T', $xml->pubDate, new \DateTimeZone('UTC'));
    $torrent->userId = $userId;

    return $torrent;
  }
public static function fromSimpleXml($xml, $userId = null)
  {
    $torrent = new NyaaTorrent();
    $torrent->title = (string)$xml->title;
    $torrent->setInfoFromDescription((string)$xml->description);
    $torrent->meta = NyaaMeta::createFromTitle($torrent->title);

    $torrent->torrentUrl = (string)$xml->link;
    $torrent->siteUrl = (string)$xml->guid;
    $torrent->category = (string)$xml->category;
    $torrent->publishDate = \DateTime::createFromFormat('D, d M Y H:i:s T', $xml->pubDate, new \DateTimeZone('UTC'));
    $torrent->userId = $userId;

    return $torrent;
  }
public static function fromSimpleXml ( $ xml , $ userId = null ) { $ torrent = new NyaaTorrent ( ) ; $ torrent -> title = ( string ) $ xml -> title ; $ torrent -> setInfoFromDescription ( ( string ) $ xml -> description ) ; $ torrent -> meta = NyaaMeta :: createFromTitle ( $ torrent -> title ) ; $ torrent -> torrentUrl = ( string ) $ xml -> link ; $ torrent -> siteUrl = ( string ) $ xml -> guid ; $ torrent -> category = ( string ) $ xml -> category ; $ torrent -> publishDate = \ DateTime :: createFromFormat ( 'D, d M Y H:i:s T' , $ xml -> pubDate , new \ DateTimeZone ( 'UTC' ) ) ; $ torrent -> userId = $ userId ; return $ torrent ; }
Creates a new NyaaTorrent instance from a simple xml element

@param \SimpleXmlElement $xml The SimpleXmlElement from the Nyaa feed containing the torrent info
@param int $userId The userid of this torrent
@return NyaaTorrent
Creates a new NyaaTorrent instance from a simple xml element