src/Filter/Zbar/Extract.php
public function process(ThingInterface $thing, $sourcePath, OptionsInterface $options = null)
    {
        $tmpPath = tempnam(sys_get_temp_dir(), 'Dadatata');

        $pb = new ProcessBuilder(
            [
                $this->bin
            ]
        );
        $pb->add('--xml');
        $pb->add($sourcePath);
        $process = $pb->getProcess();

        $code = $process->run();
        if ($code !== 0) {
            throw ProcessingFailedException::create(
                'Failed to extract barcodes',
                $code,
                $process->getOutput(),
                $process->getErrorOutput()
            );
        }

        file_put_contents($tmpPath, $process->getOutput());

        return [$tmpPath];
    }
public function process(ThingInterface $thing, $sourcePath, OptionsInterface $options = null)
    {
        $tmpPath = tempnam(sys_get_temp_dir(), 'Dadatata');

        $pb = new ProcessBuilder(
            [
                $this->bin
            ]
        );
        $pb->add('--xml');
        $pb->add($sourcePath);
        $process = $pb->getProcess();

        $code = $process->run();
        if ($code !== 0) {
            throw ProcessingFailedException::create(
                'Failed to extract barcodes',
                $code,
                $process->getOutput(),
                $process->getErrorOutput()
            );
        }

        file_put_contents($tmpPath, $process->getOutput());

        return [$tmpPath];
    }
public function process ( ThingInterface $ thing , $ sourcePath , OptionsInterface $ options = null ) { $ tmpPath = tempnam ( sys_get_temp_dir ( ) , 'Dadatata' ) ; $ pb = new ProcessBuilder ( [ $ this -> bin ] ) ; $ pb -> add ( '--xml' ) ; $ pb -> add ( $ sourcePath ) ; $ process = $ pb -> getProcess ( ) ; $ code = $ process -> run ( ) ; if ( $ code !== 0 ) { throw ProcessingFailedException :: create ( 'Failed to extract barcodes' , $ code , $ process -> getOutput ( ) , $ process -> getErrorOutput ( ) ) ; } file_put_contents ( $ tmpPath , $ process -> getOutput ( ) ) ; return [ $ tmpPath ] ; }
@param ThingInterface                              $thing
@param string                                      $sourcePath
@param \Asoc\Dadatata\Filter\OptionsInterface|null $options

@throws \Asoc\Dadatata\Exception\ProcessingFailedException
@return array Paths to generated files
@param ThingInterface $thing @param string $sourcePath @param \ Asoc \ Dadatata \ Filter \ OptionsInterface|null $options