Met en forme la pagination si elle existe

@param \SimpleXMLElement $xmldata

@return Pagination|null null si elle n'existe pas
547289
private function parsePagination(\SimpleXMLElement $xmldata)
    {
        $pagination = new Pagination();
        $paginated = false;

        foreach ($xmldata->children('opensearch', true) as $key => $value) {
            switch ($key) {
                case 'totalResults':
                    $pagination->setNumberOfItem((int) $value);
                    $paginated = true;
                    break;
                case 'itemsPerPage':
                    $pagination->setItemsPerPage((int) $value);
                    $paginated = true;
                    break;
            }
        }

        return $paginated ? $pagination : null;
    }
897107
public function parse_xml( $data = null ) {

		if ( ! empty( $data ) ) {
			$this->input = $data;
		}

		$xml = new SimpleXMLElement( $this->input );

		if ( ! isset( $xml->items ) ) {
			return false;
		}

		$data = array(
			'columns' => array(),
			'items'   => array(),
		);

		/**
		 * @var $child      SimpleXMLElement
		 * @var $item_child SimpleXMLElement
		 * @var $data_child SimpleXMLElement
		 */

		if ( isset( $xml->columns ) ) {
			foreach ( $xml->columns->children() as $child ) {
				$sub = $child->getName();

				if ( empty( $sub ) || 'column' !== $sub ) {
					continue;
				}

				if ( isset( $child->name ) ) {
					if ( is_array( $child->name ) ) {
						$column = $child->name[0];
					} else {
						$column = $child->name;
					}

					$data['columns'][] = $column;
				}
			}
		}

		foreach ( $xml->items->children() as $child ) {
			$sub = $child->getName();

			if ( empty( $sub ) || 'item' !== $sub ) {
				continue;
			}

			$item = array();

			$attributes = $child->attributes();

			if ( ! empty( $attributes ) ) {
				foreach ( $attributes as $column => $value ) {
					if ( ! in_array( $column, $data['columns'], true ) ) {
						$data['columns'][] = $column;
					}

					$item[ $column ] = $value;
				}
			}

			$item_child = $child->children();

			if ( ! empty( $item_child ) ) {
				foreach ( $item_child->children() as $data_child ) {
					$column = $data_child->getName();

					if ( ! in_array( $column, $data['columns'], true ) ) {
						$data['columns'][] = $column;
					}

					$item[ $column ] = $item_child->$column;
				}
			}

			if ( ! empty( $item ) ) {
				$data['items'][] = $item;
			}
		}//end foreach

		$this->parsed = $data;

		return $this->parsed;
	}
1161832
public function setRibbonXMLData($Target=NULL, $XMLData=NULL){
		if(!is_null($Target) && !is_null($XMLData)){
			$this->_ribbonXMLData=array('target'=>$Target, 'data'=>$XMLData);
		}else{
			$this->_ribbonXMLData=NULL;
		}
	}
1153547
public static function createFromXml(SimpleXMLElement $xmlAddress)
    {
        $address = new DTO\Address();

        if (isset($xmlAddress->Ctry)) {
            $address = $address->setCountry((string) $xmlAddress->Ctry);
        }
        if (isset($xmlAddress->CtrySubDvsn)) {
            $address = $address->setCountrySubDivision((string) $xmlAddress->CtrySubDvsn);
        }
        if (isset($xmlAddress->Dept)) {
            $address = $address->setDepartment((string) $xmlAddress->Dept);
        }
        if (isset($xmlAddress->SubDept)) {
            $address = $address->setSubDepartment((string) $xmlAddress->SubDept);
        }
        if (isset($xmlAddress->StrtNm)) {
            $address = $address->setStreetName((string) $xmlAddress->StrtNm);
        }
        if (isset($xmlAddress->BldgNb)) {
            $address = $address->setBuildingNumber((string) $xmlAddress->BldgNb);
        }
        if (isset($xmlAddress->PstCd)) {
            $address = $address->setPostCode((string) $xmlAddress->PstCd);
        }
        if (isset($xmlAddress->TwnNm)) {
            $address = $address->setTownName((string) $xmlAddress->TwnNm);
        }
        if (isset($xmlAddress->AdrLine)) {
            foreach ($xmlAddress->AdrLine as $line) {
                $address = $address->addAddressLine((string)$line);
            }
        }

        return $address;
    }
697085
public function getData($offset)
    {
        $this->parserPosition = null;
        $this->parserLevel    = 0;
        $data        = "";
        $parser      = @\xml_parser_create();
        $filePointer = $this->getIndex()->getFile()->getFilePointer();

        if (! \is_resource($parser)) {
            $error = \error_get_last();
            throw new ReadDataIndexException(
                "Could not create a xml parser: $error[message]"
            );

        }

        \xml_set_element_handler(
            $parser,
            array($this, "onStartElement"),
            array($this, "onEndElement")
        );

        \fseek($filePointer, $offset);
        while (\is_null($this->parserPosition)
                    && $chunk = \fread($filePointer, $this->getIndex()->getFile()->getBlockSize())
        ) {
            $data .= $chunk;
            \xml_parse($parser, $chunk);

        }

        \xml_parser_free($parser);

        if (\is_null($this->parserPosition)) {
            throw new ReadDataIndexException("Did not read any data");

        }
        return \substr($data, 0, $this->parserPosition);
    }
970188
public static function trim(array $contentData)
    {
        $data = [];

        foreach ($contentData as $item) {
            $data[] = trim($item);
        }

        return $data;
    }
299100
protected function getSourceElement(): ?XmlElement
    {
        $list = $this->node->getElementsByTagNameNS(XliffFile::XLIFF_NS, 'source');
        if ($list->length && $element = $list->item(0)) {
            /** @var XmlElement $element */
            return $element;
        }

        return null;
    }
813138
public static function isSupportedFormatAndVersion ($xmlData) {
        $xmlreader = new \XMLReader();
        $xmlreader->XML($xmlData);

        return self::isValidFormatAndVersion($xmlreader);

    }
446349
public function fromXml(SimpleXMLElement $xmlElement)
    {
        $classname = $this->xmlElementToClassname($xmlElement);
        if (!is_null($classname)) {
            $return = new $classname();
            if ($return instanceof ArrayObject) {
                foreach ($xmlElement as $xmlChild) {
                    $return->append($this->fromXml($xmlChild));
                }
            } else {
                $objectData = array();
                foreach ($xmlElement as $xmlChild) {
                    $key = $this->xmlkeyToProperty($xmlChild->getName());
                    if (isset($objectData[$key])) {
                        if (!is_array($objectData[$key])) {
                            $objectData[$key] = array($objectData[$key]);
                        }
                        $objectData[$key][] = $this->fromXml($xmlChild);
                    } else {
                        $objectData[$key] = $this->fromXml($xmlChild);
                    }
                }
                $return->setData($objectData, false);
            }
        } else {
            $return = $this->castValue($xmlElement);
        }

        return $return;
    }
1285708
protected function xmlSerialize($data, $xml = null)
    {
        if ( !$xml instanceof SimpleXMLElement )
        {
            $xml = new SimpleXMLElement('<'. $this->requestName .' xmlns="'. $this->namespace .'" />');
        }

        foreach ($data as $key => $value)
        {
            if ( !isset($value) )
            {
                continue;
            }

            if ( is_array($value) )
            {
                $node = $xml->addChild($key);
                $this->xmlSerialize($value, $node);
            }
            else
            {
                $xml->addChild($key, $value);
            }
        }

        return $xml->asXML();
    }
284696
public function setTemplateData(array $templateData)
    {
        if (!isset($this->templateData)) {
            $this->templateData = [];
        }

        $this->templateData = array_merge($this->templateData, $templateData);

        return $this;
    }
731534
private function multicallDecode($xml_data) {

        $data = array();

        try {

            $calls = $xml_data->params->param->value->children();

            $calls_array = $this->decodeArray($calls[0]);

            foreach ( $calls_array as $call ) {
                
                $data[] = (!isset($call['methodName']) || !isset($call['params'])) ? null : array($call['methodName'], $call['params']);

            }
            
        } catch (XmlrpcException $xe) {
            
            throw $xe;

        }
        
        return $data;

    }
1307027
public function extract($xmltext)
	{
		try {
			$xml = new DOMDocument();
			$xml->loadXML($xmltext);
			$array_e = $xml->getElementsByTagName('Encrypt');
			$array_a = $xml->getElementsByTagName('ToUserName');
			$encrypt = $array_e->item(0)->nodeValue;
			$tousername = $array_a->item(0)->nodeValue;
			return array(0, $encrypt, $tousername);
		} catch (Exception $e) {
			//print $e . "\n";
			return array(ErrorCode::$ParseXmlError, null, null);
		}
	}
86560
public function xml(array $data, $charset = null)
    {
        $dom = new DOMDocument('1.0', $charset === null ? Yii::$app->charset : $charset);
        $root = new DOMElement('xml');
        $dom->appendChild($root);
        $this->buildXml($root, $data);
        $xml = $dom->saveXML();
        return trim(substr($xml, strpos($xml, '?>') + 2));
    }
1110238
protected static function convertXmlToArray(\SimpleXMLElement $data)
    {
        $result = [];
        foreach ((array) $data as $index => $node) {
            $result[$index] = (\is_object($node)) ? static::convertXmlToArray($node) : trim((string) $node);
        }

        return $result;
    }
137431
protected function _getXml()
    {
        if ($this->_xml) {
            return $this->_xml;
        }
        libxml_use_internal_errors();
        $data = simplexml_load_string($this->_getBody());
        if ($data) {
            $this->_xml = $data;

            return $this->_xml;
        }

        return null;
    }
1075948
public static function getParallelLimit($tokenData)
    {
        if (!empty($tokenData['owner']['limits'][self::PARALLEL_LIMIT_NAME]['value'])) {
            return (int) $tokenData['owner']['limits'][self::PARALLEL_LIMIT_NAME]['value'];
        }

        return null;
    }