/** * Look for a type * @param DOM $dom * @param string $class * @return DOMNode */ protected function __findType(&$dom, $class) { $types_node = $dom->getElementsByTagName('types')->item(0); $schema_list = $types_node->getElementsByTagName('schema'); for ($i = 0; $i < $schema_list->length; $i++) { $children = $schema_list->item($i)->childNodes; for ($j = 0; $j < $children->length; $j++) { $node = $children->item($j); if ($node instanceof DOMElement && $node->hasAttributes() && is_object($node->attributes->getNamedItem('name')) && $node->attributes->getNamedItem('name')->nodeValue == $class) { return $node; } } } return null; }
/** * __simpleGetDate * Recupera e reformata a data do padrão da NFe para dd/mm/aaaa * @package NFePHP * @version 1.0 * @author Marcos Diez * @param DOM $theObj * @param string $keyName identificador da TAG do xml * @param string $extraText prefixo do retorno * @return string */ protected function __simpleGetDate($theObj, $keyName, $extraText) { $vct = $theObj->getElementsByTagName($keyName)->item(0); if (isset($vct)) { $theDate = explode("-", $vct->nodeValue); return $extraText . $theDate[2] . "/" . $theDate[1] . "/" . $theDate[0]; } return ""; }