src/CfdiUtils/Cleaner/Cleaner.php
public function load(string $content)
    {
        try {
            $cfdi = Cfdi::newFromString($content);
        } catch (\Throwable $exception) {
            throw new CleanerException($exception->getMessage(), $exception->getCode(), $exception->getPrevious());
        }
        $version = $cfdi->getVersion();
        if (! $this->isVersionAllowed($version)) {
            throw new CleanerException("The CFDI version '$version' is not allowed");
        }
        $this->dom = $cfdi->getDocument();
    }
public function load(string $content)
    {
        try {
            $cfdi = Cfdi::newFromString($content);
        } catch (\Throwable $exception) {
            throw new CleanerException($exception->getMessage(), $exception->getCode(), $exception->getPrevious());
        }
        $version = $cfdi->getVersion();
        if (! $this->isVersionAllowed($version)) {
            throw new CleanerException("The CFDI version '$version' is not allowed");
        }
        $this->dom = $cfdi->getDocument();
    }
public function load ( string $ content ) { try { $ cfdi = Cfdi :: newFromString ( $ content ) ; } catch ( \ Throwable $ exception ) { throw new CleanerException ( $ exception -> getMessage ( ) , $ exception -> getCode ( ) , $ exception -> getPrevious ( ) ) ; } $ version = $ cfdi -> getVersion ( ) ; if ( ! $ this -> isVersionAllowed ( $ version ) ) { throw new CleanerException ( "The CFDI version '$version' is not allowed" ) ; } $ this -> dom = $ cfdi -> getDocument ( ) ; }
Load the string content as a CFDI
This is exposed to reuse the current object instead of create a new instance

@param string $content

@throws CleanerException when the content is not valid xml
@throws CleanerException when the document does not use the namespace http://www.sat.gob.mx/cfd/3
@throws CleanerException when cannot find a Comprobante version (or Version) attribute
@throws CleanerException when the version is not compatible

@return void
Load the string content as a CFDI This is exposed to reuse the current object instead of create a new instance