createFromXml() public static method

public static createFromXml ( SimpleXMLElement $xml, Connection $obj = null )
$xml SimpleXMLElement
$obj Connection
コード例 #1
0
ファイル: API.php プロジェクト: opendatach/transport
 /**
  * @return array
  */
 public function findConnections(ConnectionQuery $query)
 {
     // send request
     $result = $this->sendAndParseQuery($query);
     // load pages
     for ($i = 0; $i < abs($query->page); $i++) {
         // load next page
         $pageQuery = new ConnectionPageQuery($query, (string) $result->ConRes->ConResCtxt);
         $result = $this->sendAndParseQuery($pageQuery);
     }
     $connections = [];
     if ($result->ConRes->ConnectionList->Connection) {
         foreach ($result->ConRes->ConnectionList->Connection as $connection) {
             $connections[] = Entity\Schedule\Connection::createFromXml($connection, null);
         }
     }
     return $connections;
 }
コード例 #2
0
ファイル: API.php プロジェクト: BJDev95/Transport
 /**
  * @return array
  */
 public function findConnections(ConnectionQuery $query)
 {
     // send request
     $response = $this->sendQuery($query);
     // parse result
     $result = simplexml_load_string($response->getContent());
     // load pages
     for ($i = 0; $i < abs($query->page); $i++) {
         // load next page
         $pageQuery = new ConnectionPageQuery($query, (string) $result->ConRes->ConResCtxt);
         $response = $this->sendQuery($pageQuery);
         $result = simplexml_load_string($response->getContent());
     }
     $connections = array();
     if ($result->ConRes->ConnectionList->Connection) {
         foreach ($result->ConRes->ConnectionList->Connection as $connection) {
             $connections[] = Entity\Schedule\Connection::createFromXml($connection, null);
         }
     }
     return $connections;
 }
コード例 #3
0
 public function testCreateFromXml()
 {
     $xml = simplexml_load_file(__DIR__ . '/../../../../fixtures/archive/connection-2012-01-16.xml');
     $this->assertEquals($this->getConnection(), Connection::createFromXml($xml->ConRes->ConnectionList->Connection));
 }