public function getXml(string $url): XmlParser
    {
        $uri = "http://{$this->ip}:1400{$url}";
        $key = str_replace("/", "_", $this->ip . $url);

        if ($this->cache->has($key)) {
            $this->logger->info("getting xml from cache: {$uri}");
            $xml = $this->cache->get($key);
            if ($xml) {
                return new XmlParser($xml);
            }
            $this->logger->error("empty xml in cache");
        }

        $this->logger->notice("requesting xml from: {$uri}");
        $xml = (string) (new Client())->get($uri)->getBody();

        $this->cache->set($key, $xml, new \DateInterval("P1D"));

        return new XmlParser($xml);
    }
public function getXml(string $url): XmlParser
    {
        $uri = "http://{$this->ip}:1400{$url}";
        $key = str_replace("/", "_", $this->ip . $url);

        if ($this->cache->has($key)) {
            $this->logger->info("getting xml from cache: {$uri}");
            $xml = $this->cache->get($key);
            if ($xml) {
                return new XmlParser($xml);
            }
            $this->logger->error("empty xml in cache");
        }

        $this->logger->notice("requesting xml from: {$uri}");
        $xml = (string) (new Client())->get($uri)->getBody();

        $this->cache->set($key, $xml, new \DateInterval("P1D"));

        return new XmlParser($xml);
    }
public function getXml ( string $ url ) : XmlParser { $ uri = "http://{$this->ip}:1400{$url}" ; $ key = str_replace ( "/" , "_" , $ this -> ip . $ url ) ; if ( $ this -> cache -> has ( $ key ) ) { $ this -> logger -> info ( "getting xml from cache: {$uri}" ) ; $ xml = $ this -> cache -> get ( $ key ) ; if ( $ xml ) { return new XmlParser ( $ xml ) ; } $ this -> logger -> error ( "empty xml in cache" ) ; } $ this -> logger -> notice ( "requesting xml from: {$uri}" ) ; $ xml = ( string ) ( new Client ( ) ) -> get ( $ uri ) -> getBody ( ) ; $ this -> cache -> set ( $ key , $ xml , new \ DateInterval ( "P1D" ) ) ; return new XmlParser ( $ xml ) ; }
Retrieve some xml from the device.

@param string $url The url to retrieve

@return XmlParser
Retrieve some xml from the device .