for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Gnutix\StarWarsLibrary\LibraryFactory;
use Gnutix\Library\LibraryFactory\XmlLibraryFactory as BaseXmlLibraryFactory;
use Gnutix\StarWarsLibrary\Model\Library;
/**
* Library Factory for the XML data
*
* @method Library getLibrary() This allows the auto-completion to work correctly
*/
class XmlLibraryFactory extends BaseXmlLibraryFactory
{
* {@inheritDoc}
protected function getLibraryDependencies(\SimpleXMLElement $data)
return array_merge(
parent::getLibraryDependencies($data),
array(
'eras' => $this->buildClassInstanceFromNodeAttributes($data, '//books/era', 'era'),
)
);
}
protected function getBooksDependencies(\SimpleXMLElement $data, \SimpleXMLElement $book)
$era = $book->xpath('parent::era');
parent::getBooksDependencies($data, $book),
'chronologicalMarker' => new $this->classes['chronologicalMarker'](
'timeStart' => (string) $book->{'time'},
'era' => new $this->classes['era']($this->getSimpleXmlElementAttributesAsArray(reset($era))),