src/Decoder.php
public function decodeRequest($URI)
    {
        if (!is_string($URI)) {
            throw new \InvalidArgumentException('A string was expected');
        }

        $reader = $this->getReader($URI, true);
        $ldel = libxml_disable_entity_loader(true);
        $luie = libxml_use_internal_errors(true);
        libxml_clear_errors();
        try {
            $this->expectStartTag($reader, 'methodCall');
            $this->expectStartTag($reader, 'methodName');
            $methodName = $this->parseText($reader);
            $this->expectEndTag($reader, 'methodName');

            $params         = array();
            $emptyParams    = null;
            try {
                $this->expectStartTag($reader, 'params');
            } catch (\InvalidArgumentException $emptyParams) {
                // Nothing to do here (no arguments given).
            }

            if (!$emptyParams) {
                $endOfParams = null;
                while (true) {
                    try {
                        $this->expectStartTag($reader, 'param');
                    } catch (\InvalidArgumentException $endOfParams) {
                        // Nothing to do here (end of arguments).
                    }

                    if ($endOfParams) {
                        break;
                    }

                    $this->expectStartTag($reader, 'value');
                    $params[] = $this->decodeValue($reader);
                    $this->expectEndTag($reader, 'value');
                    $this->expectEndTag($reader, 'param');
                }
                $this->expectEndTag($reader, 'params');
            }
            $this->expectEndTag($reader, 'methodCall');

            $endOfFile = null;
            try {
                $this->readNode($reader);
            } catch (\InvalidArgumentException $endOfFile) {
            }

            if (!$endOfFile) {
                throw new \InvalidArgumentException('Expected end of document');
            }

            $request = new \fpoirotte\XRL\Request($methodName, $params);
            libxml_disable_entity_loader($ldel);
            libxml_clear_errors();
            libxml_use_internal_errors($luie);
            return $request;
        } catch (\Exception $e) {
            libxml_disable_entity_loader($ldel);
            libxml_clear_errors();
            libxml_use_internal_errors($luie);
            throw $e;
        }
    }
public function decodeRequest($URI)
    {
        if (!is_string($URI)) {
            throw new \InvalidArgumentException('A string was expected');
        }

        $reader = $this->getReader($URI, true);
        $ldel = libxml_disable_entity_loader(true);
        $luie = libxml_use_internal_errors(true);
        libxml_clear_errors();
        try {
            $this->expectStartTag($reader, 'methodCall');
            $this->expectStartTag($reader, 'methodName');
            $methodName = $this->parseText($reader);
            $this->expectEndTag($reader, 'methodName');

            $params         = array();
            $emptyParams    = null;
            try {
                $this->expectStartTag($reader, 'params');
            } catch (\InvalidArgumentException $emptyParams) {
                // Nothing to do here (no arguments given).
            }

            if (!$emptyParams) {
                $endOfParams = null;
                while (true) {
                    try {
                        $this->expectStartTag($reader, 'param');
                    } catch (\InvalidArgumentException $endOfParams) {
                        // Nothing to do here (end of arguments).
                    }

                    if ($endOfParams) {
                        break;
                    }

                    $this->expectStartTag($reader, 'value');
                    $params[] = $this->decodeValue($reader);
                    $this->expectEndTag($reader, 'value');
                    $this->expectEndTag($reader, 'param');
                }
                $this->expectEndTag($reader, 'params');
            }
            $this->expectEndTag($reader, 'methodCall');

            $endOfFile = null;
            try {
                $this->readNode($reader);
            } catch (\InvalidArgumentException $endOfFile) {
            }

            if (!$endOfFile) {
                throw new \InvalidArgumentException('Expected end of document');
            }

            $request = new \fpoirotte\XRL\Request($methodName, $params);
            libxml_disable_entity_loader($ldel);
            libxml_clear_errors();
            libxml_use_internal_errors($luie);
            return $request;
        } catch (\Exception $e) {
            libxml_disable_entity_loader($ldel);
            libxml_clear_errors();
            libxml_use_internal_errors($luie);
            throw $e;
        }
    }
/ \copydoc fpoirotte::XRL::DecoderInterface::decodeRequest()