src/CfdiUtils/XmlResolver/XmlResolver.php
public function resolve(string $resource, string $type = ''): string
    {
        if (! $this->hasLocalPath()) {
            return $resource;
        }
        if ('' === $type) {
            $type = $this->obtainTypeFromUrl($resource);
        } else {
            $type = strtoupper($type);
        }
        $retriever = $this->newRetriever($type);
        if (null === $retriever) {
            throw new \RuntimeException("Unable to handle the resource (Type: $type) $resource");
        }
        $local = $retriever->buildPath($resource);
        if (! file_exists($local)) {
            $retriever->retrieve($resource);
        }
        return $local;
    }
public function resolve(string $resource, string $type = ''): string
    {
        if (! $this->hasLocalPath()) {
            return $resource;
        }
        if ('' === $type) {
            $type = $this->obtainTypeFromUrl($resource);
        } else {
            $type = strtoupper($type);
        }
        $retriever = $this->newRetriever($type);
        if (null === $retriever) {
            throw new \RuntimeException("Unable to handle the resource (Type: $type) $resource");
        }
        $local = $retriever->buildPath($resource);
        if (! file_exists($local)) {
            $retriever->retrieve($resource);
        }
        return $local;
    }
public function resolve ( string $ resource , string $ type = '' ) : string { if ( ! $ this -> hasLocalPath ( ) ) { return $ resource ; } if ( '' === $ type ) { $ type = $ this -> obtainTypeFromUrl ( $ resource ) ; } else { $ type = strtoupper ( $ type ) ; } $ retriever = $ this -> newRetriever ( $ type ) ; if ( null === $ retriever ) { throw new \ RuntimeException ( "Unable to handle the resource (Type: $type) $resource" ) ; } $ local = $ retriever -> buildPath ( $ resource ) ; if ( ! file_exists ( $ local ) ) { $ retriever -> retrieve ( $ resource ) ; } return $ local ; }
Resolve a resource to a local path.
If it does not have a localPath then it will return the exact same resource

@param string $resource The url
@param string $type Allows XSD, XSLT and CER
@return string
Resolve a resource to a local path . If it does not have a localPath then it will return the exact same resource