Example #1
0
 /**
  * Parse the file. Petrol will go through $file line by line and send each line
  * to this parse method.
  *
  * @param string $line [individual lines from file]
  *
  * @return array $data  [array of columns => values for line]
  */
 protected function parse($line)
 {
     $this->setRootTag('catalog');
     $data = $this->xmlToData($line, 'book', $this->columns);
     if (!is_null($data)) {
         $this->connection->insertRow($data);
     }
 }
Example #2
0
 /**
  * Parse the file. Petrol will go through $file line by line and send each line
  * to this parse method.
  *
  * @param string $line [individual lines from file]
  *
  * @return array $data  [array of columns => values for line]
  */
 protected function parse($line)
 {
     $this->setRootTag('catalog');
     $info = $this->xmlToArrays($line, 'book');
     if (!is_null($info)) {
         $data['book_id'] = $this->getAttributeFromArray($info, 'id');
         $data['info'] = json_encode($info);
         $this->connection->insertRow($data);
     }
 }
Example #3
0
 /**
  * Parse the file. Petrol will go through $file line by line and send each line
  * to this parse method.
  *
  * @param string $line [individual lines from file]
  *
  * @return array $data  [array of columns => values for line]
  */
 protected function parse($line)
 {
     $data = array_combine($this->columns, $this->cleanExplode('/', $line));
     $this->connection->insertRow($data);
 }