Example #1
0
 /**
  * Add the node to a position under the tree
  *
  * @param \SimpleXmlElement|Element $node
  * @param Element $parent
  */
 public function addChild($node, $parent = null)
 {
     if ($node instanceof \SimpleXmlElement) {
         $name = $node->getName();
         $attributes = (array) $node->attributes();
         $content = trim((string) $node);
         $element = new Element($name, $attributes, $content);
         if (!$this->tree) {
             $this->tree = $element;
         } else {
             if (!$parent) {
                 $parent = $this->tree;
             }
             $parent->addChild($element);
         }
         // Add child elements recursive
         if ($node->count() > 0) {
             foreach ($node as $childNode) {
                 $this->addChild($childNode, $element);
             }
         }
     } else {
         if ($node instanceof Element) {
             if (!$this->tree) {
                 $this->tree = $node;
             } else {
                 if (!$parent) {
                     $parent = $this->tree;
                 }
                 $parent->addChild($node);
             }
         }
     }
 }
Example #2
0
 /**
  * arrayToXml
  *
  * @param  string $array        Array to convert to xml
  * @param  string $rootNodeName Name of the root node
  * @param  string $xml          SimpleXmlElement
  * @return string $asXml        String of xml built from array
  */
 public static function arrayToXml($array, $rootNodeName = 'data', $xml = null, $charset = null)
 {
     if ($xml === null) {
         $xml = new SimpleXmlElement("<?xml version=\"1.0\" encoding=\"utf-8\"?><{$rootNodeName}/>");
     }
     foreach ($array as $key => $value) {
         $key = preg_replace('/[^a-z]/i', '', $key);
         if (is_array($value) && !empty($value)) {
             $node = $xml->addChild($key);
             foreach ($value as $k => $v) {
                 if (is_numeric($v)) {
                     unset($value[$k]);
                     $node->addAttribute($k, $v);
                 }
             }
             self::arrayToXml($value, $rootNodeName, $node, $charset);
         } else {
             if (is_int($key)) {
                 $xml->addChild($value, 'true');
             } else {
                 $charset = $charset ? $charset : 'utf-8';
                 if (strcasecmp($charset, 'utf-8') !== 0 && strcasecmp($charset, 'utf8') !== 0) {
                     $value = iconv($charset, 'UTF-8', $value);
                 }
                 $value = htmlspecialchars($value, ENT_COMPAT, 'UTF-8');
                 $xml->addChild($key, $value);
             }
         }
     }
     return $xml->asXML();
 }
Example #3
0
 /**
  * Parse Links
  *
  * Parses an XML file returned by a link resolver
  * and converts it to a standardised format for display
  *
  * @param string $xmlstr Raw XML returned by resolver
  *
  * @return array         Array of values
  */
 public function parseLinks($xmlstr)
 {
     $records = [];
     // array to return
     try {
         $xml = new \SimpleXmlElement($xmlstr);
     } catch (\Exception $e) {
         return $records;
     }
     $root = $xml->xpath("//ctx_obj_targets");
     $xml = $root[0];
     foreach ($xml->children() as $target) {
         $record = [];
         $record['title'] = (string) $target->target_public_name;
         $record['href'] = (string) $target->target_url;
         $record['service_type'] = (string) $target->service_type;
         if (isset($target->coverage->coverage_text)) {
             $coverageText =& $target->coverage->coverage_text;
             $record['coverage'] = (string) $coverageText->threshold_text->coverage_statement;
             if (isset($coverageText->embargo_text->embargo_statement)) {
                 $record['coverage'] .= ' ' . (string) $coverageText->embargo_text->embargo_statement;
                 $record['embargo'] = (string) $coverageText->embargo_text->embargo_statement;
             }
         }
         if (isset($target->coverage)) {
             $record['coverage_details'] = json_decode(json_encode($target->coverage), true);
         }
         array_push($records, $record);
     }
     return $records;
 }
 /**
  * {@inheritDoc}
  */
 public function parseArtifact(Build $build, $artifact)
 {
     $this->build = $build;
     $this->artifact = $artifact ? new \SimpleXMLElement($artifact) : false;
     $this->details['totalMethods'] = 0;
     $this->details['totalStatements'] = 0;
     $this->details['totalConditionals'] = 0;
     $this->details['coveredMethods'] = 0;
     $this->details['coveredStatements'] = 0;
     $this->details['coveredConditionals'] = 0;
     $this->details['total'] = 0;
     $this->details['covered'] = 0;
     if ($this->artifact) {
         foreach ($this->artifact->xpath('//file/class/metrics') as $metric) {
             $this->details['totalMethods'] += (int) $metric['methods'];
             $this->details['totalStatements'] += (int) $metric['statements'];
             $this->details['totalConditionals'] += (int) $metric['conditionals'];
             $this->details['coveredMethods'] += (int) $metric['coveredmethods'];
             $this->details['coveredStatements'] += (int) $metric['coveredstatements'];
             $this->details['coveredConditionals'] += (int) $metric['coveredconditionals'];
             $this->details['total'] += (int) $metric['methods'] + (int) $metric['statements'] + (int) $metric['conditionals'];
             $this->details['covered'] += (int) $metric['coveredmethods'] + (int) $metric['coveredstatements'] + (int) $metric['coveredconditionals'];
         }
     }
     $this->calculateTotals();
     if ($build->getParent()) {
         $parent = $build->getParent();
         $statistics = $parent->getFlatStatistics();
         $this->generateCoverageComparisonStatistics($statistics);
     }
 }
Example #5
0
 public function fetch($params)
 {
     $feed = null;
     //debug($params);
     if (isset($params['source'])) {
         $handle = fopen($params['source'], "rb");
         $feed = stream_get_contents($handle);
         fclose($handle);
     } else {
         echo 'A source is required.';
     }
     //debug($feed);
     $feed = new SimpleXmlElement($feed);
     if (isset($params['limit']) and $params['limit'] > 0) {
         // Not possible in SimpleXmlElement objects
     }
     //debug($feed); exit;
     if (isset($params['raw']) and $params['raw'] === true) {
         echo $feed->asXml();
     }
     if (isset($params['convert']) and $params['convert'] == 'json') {
         $feed = $this->convertToJson($feed->asXml());
     }
     //debug($feed);
     echo $feed;
 }
Example #6
0
 /**
  * Add to service xml description identifier by REST info
  * @param SimpleXmlElement $xmlProduct
  * @param array $serviceRest
  */
 private function addXmlIdentifier($xmlProduct, $serviceRest) {
     if($serviceRest['1c_id'] != null ) {
         $xmlProduct->addChild("Ид", $serviceRest['1c_id']); 
     } else {
         $xmlProduct->addChild("Ид", $serviceRest['servicename']); 
     }
 }
Example #7
0
File: Xml.php Project: swk/bluebox
 /**
  * arrayToXml
  *
  * @param  string $array        Array to convert to xml    
  * @param  string $rootNodeName Name of the root node
  * @param  string $xml          SimpleXmlElement
  * @return string $asXml        String of xml built from array
  */
 public static function arrayToXml($array, $rootNodeName = 'data', $xml = null)
 {
     if ($xml === null) {
         $xml = new SimpleXmlElement("<?xml version=\"1.0\" encoding=\"utf-8\"?><{$rootNodeName}/>");
     }
     foreach ($array as $key => $value) {
         $key = preg_replace('/[^a-z]/i', '', $key);
         if (is_array($value) && !empty($value)) {
             $node = $xml->addChild($key);
             foreach ($value as $k => $v) {
                 if (is_numeric($v)) {
                     unset($value[$k]);
                     $node->addAttribute($k, $v);
                 }
             }
             self::arrayToXml($value, $rootNodeName, $node);
         } else {
             if (is_int($key)) {
                 $xml->addChild($value, 'true');
             } else {
                 $value = htmlentities($value);
                 $xml->addChild($key, $value);
             }
         }
     }
     return $xml->asXML();
 }
Example #8
0
 public function get($count = -1, $rating = null, $filter = null)
 {
     if ($count == 0 || !is_numeric($count)) {
         $count = -1;
     }
     $url = sprintf(self::BACKEND_URL, $this->username) . ($filter == -1 ? '+in%3Ascraps' : '') . ($filter > 0 ? '%2F' . $filter : '');
     $this->data = $this->request($url);
     $xml = new SimpleXmlElement($this->data);
     $ns = $xml->getNamespaces(true);
     $items = null;
     foreach ($xml->channel->item as $item) {
         $media = $item->children($ns['media']);
         if (!(empty($this->rating) || $this->rating == 'all') && $media->rating != $this->rating) {
             continue;
         }
         if ($media->text) {
             continue;
         }
         if ($media->text) {
             continue;
         }
         if ($media->text) {
             continue;
         }
         $items .= sprintf('<li><a href="%1$s" title="%2$s - %3$s"><img src="%4$s" alt="%2$s - %3$s"/></a></li>', $item->link, $media->title, $media->copyright, $media->content->attributes()->url);
         --$count;
         if ($count > -1 && $count == 0) {
             break;
         }
     }
     return sprintf('<ul class="da-widgets gallery">%s</ul>', $items);
 }
Example #9
0
 /**
  * Add to account xml description identifier.
  * @param SimpleXmlElement $account
  * @param array $accountRest
  */
 private function addXmlAccountId($account, $accountRest) {
     $accountId = $accountRest['1c_id'];
     if($accountId == null) {
         $accountId = $accountRest['accountname'];
     }
     $account->addChild("Ид", $accountId);
 }
Example #10
0
 protected function _serializeRecurser($graphNodes, SimpleXmlElement $xmlNode)
 {
     // @todo find a better way to handle concurrency.. if no clone, _position in node gets messed up
     if ($graphNodes instanceof Zend_Tool_Project_Structure_Node) {
         $graphNodes = clone $graphNodes;
     }
     foreach ($graphNodes as $graphNode) {
         if ($graphNode->isDeleted()) {
             continue;
         }
         $nodeName = $graphNode->getContext()->getName();
         $nodeName[0] = strtolower($nodeName[0]);
         $newNode = $xmlNode->addChild($nodeName);
         $reflectionClass = new ReflectionClass($graphNode->getContext());
         if ($graphNode->isEnabled() == false) {
             $newNode->addAttribute('enabled', 'false');
         }
         foreach ($graphNode->getPersistentParameters() as $paramName => $paramValue) {
             $newNode->addAttribute($paramName, $paramValue);
         }
         if ($graphNode->hasChildren()) {
             self::_serializeRecurser($graphNode, $newNode);
         }
     }
 }
Example #11
0
 public function Save()
 {
     //if installed goto dashboard
     if ($this->getSystemSetting(OpenSms::INSTALLATION_STATUS)) {
         OpenSms::redirectToAction('index', 'dashboard');
     }
     //var_dump($_POST);die();
     // CREATE
     $config = new SimpleXmlElement('<settings/>');
     $config->{OpenSms::VERSION} = $this->getSystemSetting(OpenSms::VERSION);
     $config->{OpenSms::SITE_NAME} = $this->getFormData(OpenSms::SITE_NAME);
     $config->{OpenSms::SITE_URL} = $this->getFormData(OpenSms::SITE_URL);
     $config->{OpenSms::DB_TYPE} = 'mysql';
     $config->{OpenSms::DB_HOST} = $this->getFormData(OpenSms::DB_HOST);
     $config->{OpenSms::DB_NAME} = $this->getFormData(OpenSms::DB_NAME);
     $config->{OpenSms::DB_TABLE_PREFIX} = $this->getFormData(OpenSms::DB_TABLE_PREFIX);
     $config->{OpenSms::DB_USERNAME} = $this->getFormData(OpenSms::DB_USERNAME);
     $config->{OpenSms::DB_PASSWORD} = $this->getFormData(OpenSms::DB_PASSWORD);
     $config->{OpenSms::DB_PASSWORD} = $this->getFormData(OpenSms::DB_PASSWORD);
     $config->{OpenSms::CURRENT_THEME_KEY} = $this->getFormData(OpenSms::CURRENT_THEME_KEY);
     $config->{OpenSms::OPEN_PRICE_PER_UNIT} = $this->getFormData(OpenSms::OPEN_PRICE_PER_UNIT);
     $config->{OpenSms::OPEN_UNITS_PER_SMS} = $this->getFormData(OpenSms::OPEN_UNITS_PER_SMS);
     $config->{OpenSms::INSTALLATION_STATUS} = false;
     //unlink(OpenSms::SETTINGS_FILE_PATH);
     $config->saveXML(OpenSms::SETTINGS_FILE_PATH);
     $this->setNotification('Settings saved', 'settings_save');
     OpenSms::redirectToAction('index');
 }
Example #12
0
 public function parse()
 {
     $sXML = new \SimpleXmlElement($this->xml);
     $ns = $sXML->getNamespaces(true);
     foreach ((array) $sXML->channel as $k => $v) {
         if ($k == 'item') {
             continue;
         }
         if (!is_string($v) && !is_array($v)) {
             $v = (array) $v;
         }
         $this->meta[$k] = $v;
     }
     foreach ($sXML->channel->item as $item) {
         $i = (array) $item;
         foreach ($ns as $space => $val) {
             $children = $item->children($val);
             if ($children) {
                 foreach ($children as $c => $a) {
                     $i[$c] = (string) $a;
                 }
             }
         }
         $this->items[] = $i;
     }
 }
 /**
  * Add props to order, specified for website.
  * @param SimpleXmlElement $document
  * @param array $salesOrderRest
  */
 protected function addOrderProps($document, $salesOrderRest)
 {
     $documentProps = $document->addChild("ЗначенияРеквизитов");
     $documentProp = $documentProps->addChild("ЗначениеРеквизита");
     $documentProp->addChild("Наименование", "Номер по 1С");
     $documentProp->addChild("Значение", $salesOrderRest['fromsite']);
     if ($salesOrderRest['sostatus'] == "Created") {
         $documentProp = $documentProps->addChild("ЗначениеРеквизита");
         $documentProp->addChild("Наименование", "Проведен");
         $documentProp->addChild("Значение", "false");
     }
     if ($salesOrderRest['sostatus'] == "Approved") {
         $documentProp = $documentProps->addChild("ЗначениеРеквизита");
         $documentProp->addChild("Наименование", "Проведен");
         $documentProp->addChild("Значение", "true");
     }
     if ($salesOrderRest['sostatus'] == "Delivered") {
         $documentProp = $documentProps->addChild("ЗначениеРеквизита");
         $documentProp->addChild("Наименование", "Проведен");
         $documentProp->addChild("Значение", "true");
         $documentProp = $documentProps->addChild("ЗначениеРеквизита");
         $documentProp->addChild("Наименование", "Номер оплаты по 1С");
         $documentProp->addChild("Значение", $salesOrderRest['salesorder_no']);
     }
     if ($salesOrderRest['sostatus'] == "Cancelled") {
         $documentProp = $documentProps->addChild("ЗначениеРеквизита");
         $documentProp->addChild("Наименование", "Отменен");
         $documentProp->addChild("Значение", "true");
         $documentProp = $documentProps->addChild("ЗначениеРеквизита");
         $documentProp->addChild("Наименование", "Проведен");
         $documentProp->addChild("Значение", "false");
     }
 }
Example #14
0
 /**
  * Parse the input SimpleXmlElement into an array
  *
  * @param SimpleXmlElement $node xml to parse
  * @return array
  */
 protected function parseXml($node)
 {
     $data = array();
     foreach ($node->children() as $key => $subnode) {
         if ($subnode->count()) {
             $value = $this->parseXml($subnode);
             if ($subnode->attributes()) {
                 foreach ($subnode->attributes() as $attrkey => $attr) {
                     $value['@' . $attrkey] = (string) $attr;
                 }
             }
         } else {
             $value = (string) $subnode;
         }
         if ($key === 'item') {
             if (isset($subnode['key'])) {
                 $data[(string) $subnode['key']] = $value;
             } elseif (isset($data['item'])) {
                 $tmp = $data['item'];
                 unset($data['item']);
                 $data[] = $tmp;
                 $data[] = $value;
             }
         } elseif (key_exists($key, $data)) {
             if (false === is_array($data[$key])) {
                 $data[$key] = array($data[$key]);
             }
             $data[$key][] = $value;
         } else {
             $data[$key] = $value;
         }
     }
     return $data;
 }
Example #15
0
 /**
  * Gets a path to a node via SPL Stack implementation
  *
  * Pass in the child node and will recurse up the XML tree to print out
  * the path in the tree to that node
  *
  * <config>
  *   <path>
  *     <to>
  *       <node>
  *         Node Value
  *       </node>
  *     </to>
  *   </path>
  * </config>
  *
  * If you pass in the "node" object, this will print out
  * config/path/to/node/
  *
  * @param SimpleXmlElement $element Child element to find path to
  *
  * @return string
  * @access public
  */
 public function getPath(SimpleXmlElement $element)
 {
     $this->_iterator->push($element->getName() . '/');
     if (!$element->getSafeParent()) {
         return $this->_iterator->pop();
     }
     return $this->getPath($element->getParent()) . $this->_iterator->pop();
 }
Example #16
0
 /**
  * Gets a path to a node via array implementation
  *
  * Pass in the child node and will recurse up the XML tree to print out
  * the path in the tree to that node
  *
  * <config>
  *   <path>
  *     <to>
  *       <node>
  *         Node Value
  *       </node>
  *     </to>
  *   </path>
  * </config>
  *
  * If you pass in the "node" object, this will print out
  * config/path/to/node/
  *
  * @param SimpleXmlElement $element Child element to find path to
  *
  * @return string
  * @access public
  */
 public function getPath(SimpleXmlElement $element)
 {
     $this->_iterator[] = $element->getName() . '/';
     if (!$element->getSafeParent()) {
         return array_pop($this->_iterator);
     }
     return $this->getPath($element->getParent()) . array_pop($this->_iterator);
 }
Example #17
0
 /**
  * return an xml elements attributes in as array
  * @param \SimpleXmlElement $element
  * @return array
  */
 protected function readAttributesArray(\SimpleXmlElement $element)
 {
     $attributes = [];
     foreach ($element->attributes() as $attrName => $attr) {
         $attributes[$attrName] = (string) $attr;
     }
     return $attributes;
 }
Example #18
0
 /**
  * Add props to xml description, specified for product. Need to identificate
  * inventory as product in One Es.
  * @param SimpleXmlElement $xmlProduct
  */
 private function addXmlProps($xmlProduct) {
     $props = $xmlProduct->addChild("ЗначенияРеквизитов");
     $prop = $props->addChild("ЗначениеРеквизита");
     $prop->addChild("Наименование","ВидНоменклатуры");
     $prop->addChild("Значение","Товар");
     $prop = $props->addChild("ЗначениеРеквизита");
     $prop->addChild("Наименование","ТипНоменклатуры");
     $prop->addChild("Значение","Товар");
 }
Example #19
0
/**
 * @param SimpleXmlElement $node
 * @return string
 */
function getNodeTitle($node)
{
    if ($node->children()) {
        $nodeName = $node->children()[0]->getName();
        $subNodeName = getNodeTitle($node->children()[0]);
        return $nodeName . ($subNodeName ? ' > ' . $subNodeName : '');
    }
    return '';
}
Example #20
0
 /**
  * {@inheritdoc}
  */
 public function export(array $data)
 {
     $countriesElement = new \SimpleXmlElement("<?xml version=\"1.0\" encoding=\"utf-8\"?><countries/>");
     foreach ($data as $iso => $name) {
         $countryElement = $countriesElement->addChild('country');
         $countryElement->addChild('iso', $iso);
         $countryElement->addChild('name', $countryElement->ownerDocument->createCDATASection($name));
     }
     return $countriesElement->asXML();
 }
/** @Assertions(2) */
function test()
{
    $x = new SimpleXmlElement();
    $a = $x->asXml();
    $b = $x->asXml(__FILE__);
    /** @type string|false */
    $a;
    /** @type boolean */
    $b;
}
 /**
  * Populate the protected $_data SimpleXmlElement with the passed in array
  * Warning: no validation is done so you can end up with some crazy SimpleXmlElement objects
  * if you aren't careful passing in valid arrays.
  * 
  * The array keys may be camelCaseWords or dash-type-words. If they are camelCaseWords, they 
  * will be converted to dash-type-words for the SimpleXmlElement.
  * 
  * @param array $data
  * @param string $wrapper
  * @return void
  */
 public function hydrate(array $data, $wrapper)
 {
     $wrapper = SpreedlyCommon::camelToDash($wrapper);
     $xml = '<' . $wrapper . '/>';
     $xml = new SimpleXmlElement($xml);
     foreach ($data as $key => $value) {
         $key = SpreedlyCommon::camelToDash($key);
         $xml->addChild($key, $value);
     }
     $this->setData($xml);
 }
Example #23
0
 /**
  * Output as XML
  *
  * @param array $shellList The shell list.
  * @return void
  */
 protected function _asXml($shellList)
 {
     $shells = new SimpleXmlElement('<shells></shells>');
     foreach ($shellList as $command) {
         $callable = $command;
         $shell = $shells->addChild('shell');
         $shell->addAttribute('name', $command);
         $shell->addAttribute('call_as', $callable);
         $shell->addAttribute('help', $callable . ' -h');
     }
     $this->out($shells->saveXML());
 }
 /**
  * {@inheritDoc}
  *
  * Format:
  *
  * <ProductSalePrice product_code="xxx" group_name="">xx.xx</ProductSalePrice>
  */
 public function toXml($version = Version::CURRENT, array $options = array())
 {
     if ($version < Version::NINE) {
         return;
     }
     $xmlObject = new SimpleXmlElement('<Module />');
     $xmlObject->addAttribute('code', 'discount_saleprice');
     $xmlObject->addAttribute('feature', 'discount');
     $salePrice = $xmlObject->addChild('ProductSalePrice', $this->getPrice());
     $salePrice->addAttribute('product_code', $this->getProductCode());
     $salePrice->addAttribute('group_name', $this->getGroupName());
     return $xmlObject;
 }
Example #25
0
 public function get($count = -1)
 {
     $xml = new SimpleXmlElement($this->data);
     $ns = $xml->getNamespaces(true);
     $items = null;
     foreach ($xml->channel->item as $item) {
         $items .= sprintf('<dt><a href="%2$s">%1$s</a></dt>' . '<dd>' . '<p>%3$s</p>' . '</dd>', $item->title, $item->link, $item->description);
         --$count;
         if ($count > -1 && $count == 0) {
             break;
         }
     }
     return sprintf('<dl>%s</dl>', $items);
 }
Example #26
0
function explodeXML($xml)
{
    $objXML = new SimpleXmlElement($xml);
    if (strpos($xml, 'soap:') !== false) {
        $objXML->registerXPathNamespace('soap', 'http://www.portalfiscal.inf.br/nfe/wsdl/NfeConsulta2');
        $xml2 = (array) $objXML->xpath('//soap:Body');
    } else {
        $objXML->registerXPathNamespace('soapenv', 'http://www.w3.org/2003/05/soap-envelope');
        $xml2 = $objXML->xpath('//soapenv:Body');
    }
    $xml2[0]->children()->children()->children()->cStat;
    $xml2[0]->children()->children()->children()->xMotivo;
    $xml2[0]->children()->children()->children()->protNFe->infProt->dhRecbto;
    $xml2[0]->children()->children()->children()->protNFe->infProt->nProt;
}
Example #27
0
 protected function _writeXml()
 {
     // Write app/etc/modules/ file
     $templateFilepath = __DIR__ . '/template/Migrated_FromCore.xml';
     $moduleRegistrationDir = \Mage::getBaseDir('app') . '/etc/modules';
     $moduleRegistrationFilepath = $moduleRegistrationDir . '/Migrated_FromCore.xml';
     copy($templateFilepath, $moduleRegistrationFilepath);
     echo "Writing {$moduleRegistrationFilepath}\r\n";
     // Write etc/config.xml
     $directory = \Mage::getBaseDir('app') . '/code/local/Migrated/FromCore/etc';
     $filePath = $directory . "/config.xml";
     echo "Writing {$filePath}\r\n";
     mkdir($directory, 0755, true);
     $this->_configXml->asXML($filePath);
 }
 /**
  * {@inheritDoc}
  */
 public function getSimpleTextResult()
 {
     $violationCount = 0;
     if ($this->artifact) {
         foreach ($this->artifact->xpath('//file') as $file) {
             foreach ($file->xpath('//violation') as $violation) {
                 $violationCount++;
             }
         }
         $result = $violationCount . ' instance' . ($violationCount > 1 ? 's ' : ' ') . "of messy code found\n";
     } else {
         $result = "No Messy Code Detected\n";
     }
     return $result;
 }
 /**
  * Log any build exceptions from the CheckStyle report.
  */
 public function logBuildExceptions()
 {
     if ($this->artifact) {
         foreach ($this->artifact->xpath('//file') as $file) {
             foreach ($file->xpath('//error') as $error) {
                 $exception = new Build\BuildException();
                 $exception->setAsset(basename($file['name']));
                 $exception->setReference($error['line']);
                 $exception->setType('E');
                 $exception->setMessage($error['message']);
                 $this->build->addException($exception);
             }
         }
     }
 }
 public function send($method, $path = null, $data = array(), array $options = array())
 {
     $defaults = array('headers' => array('User-Agent' => 'Lava Surfboard'));
     $xml = new \SimpleXmlElement('<request method="' . $path . '"></request>');
     foreach ($data as $key => $val) {
         if ($val != null) {
             $xml->{$key} = $val;
         }
     }
     $xmlString = $xml->asXML();
     $data = str_replace("<?xml version=\"1.0\"?>\n", '<!--?xml version="1.0" encoding="utf-8"?-->', $xmlString);
     $path = '/api/2.1/xml-in';
     $response = parent::send($method, $path, $data, $options + $defaults);
     return new \SimpleXmlElement($response);
 }