/** * Factory * * @param SimpleXMLElement $xml * @return Newscoop\News\ContentSet */ public static function createFromXml(\SimpleXMLElement $xml) { $contentSet = new self(); if ($xml->inlineXML->count()) { $contentSet->setInlineContent($xml->inlineXML); } else { if ($xml->remoteContent->count()) { $contentSet->setRemoteContent($xml); } else { throw new \InvalidArgumentException("Unknown content in " . $xml->asXML()); } } return $contentSet; }