protected function runFilename(CFDIFactory $factory, string $argument)
    {
        if ('' === $argument) {
            $this->error('FATAL: Empty filename');
            return;
        }
        $filename = realpath($argument);
        if ('' === $filename || ! is_file($filename) || ! is_readable($filename)) {
            $this->error("File $argument FATAL: not found or is not readable");
            return;
        }
        // do the object creation
        try {
            $errors = [];
            $warnings = [];
            $reader = $factory->newCFDIReader(file_get_contents($filename), $errors, $warnings);
            foreach ($errors as $message) {
                $this->error("File $argument ERROR: $message");
            }
            foreach ($warnings as $message) {
                $this->error("File $argument WARNING: $message");
            }
            $this->write("File $argument UUID: " . $reader->getUUID());
        } catch (\Exception $ex) {
            $this->error("File $argument FATAL: " . $ex->getMessage());
        }
    }
protected function runFilename(CFDIFactory $factory, string $argument)
    {
        if ('' === $argument) {
            $this->error('FATAL: Empty filename');
            return;
        }
        $filename = realpath($argument);
        if ('' === $filename || ! is_file($filename) || ! is_readable($filename)) {
            $this->error("File $argument FATAL: not found or is not readable");
            return;
        }
        // do the object creation
        try {
            $errors = [];
            $warnings = [];
            $reader = $factory->newCFDIReader(file_get_contents($filename), $errors, $warnings);
            foreach ($errors as $message) {
                $this->error("File $argument ERROR: $message");
            }
            foreach ($warnings as $message) {
                $this->error("File $argument WARNING: $message");
            }
            $this->write("File $argument UUID: " . $reader->getUUID());
        } catch (\Exception $ex) {
            $this->error("File $argument FATAL: " . $ex->getMessage());
        }
    }
protected function runFilename ( CFDIFactory $ factory , string $ argument ) { if ( '' === $ argument ) { $ this -> error ( 'FATAL: Empty filename' ) ; return ; } $ filename = realpath ( $ argument ) ; if ( '' === $ filename || ! is_file ( $ filename ) || ! is_readable ( $ filename ) ) { $ this -> error ( "File $argument FATAL: not found or is not readable" ) ; return ; } // do the object creation try { $ errors = [ ] ; $ warnings = [ ] ; $ reader = $ factory -> newCFDIReader ( file_get_contents ( $ filename ) , $ errors , $ warnings ) ; foreach ( $ errors as $ message ) { $ this -> error ( "File $argument ERROR: $message" ) ; } foreach ( $ warnings as $ message ) { $ this -> error ( "File $argument WARNING: $message" ) ; } $ this -> write ( "File $argument UUID: " . $ reader -> getUUID ( ) ) ; } catch ( \ Exception $ ex ) { $ this -> error ( "File $argument FATAL: " . $ ex -> getMessage ( ) ) ; } }
Run only a filename, used in the run loop
@param CFDIFactory $factory
@param string $argument
@return void
Run only a filename used in the run loop