src/Plugins/CreateOkFilesPlugin.php
/**
     * Process the plugin functionality.
     *
     * @return void
     * @throws \Exception Is thrown, if the plugin can not be processed
     */
Process the plugin functionality.
@return void
@throws \Exception Is thrown, if the plugin can not be processed
Process the plugin functionality . @return void @throws \ Exception Is thrown if the plugin can not be processed
public function process()
    {
        $okFilesCreated = 1;
        $filters = array(function (SubjectConfigurationInterface $subject) {
            return $subject->isOkFileNeeded();
        });
        $subjects = $this->getConfiguration()->getSubjects($filters);
        foreach ($subjects as $subject) {
            $okFilesCreated += $this->getFileWriterFactory()->createFileWriter($subject)->createOkFiles($this->getSerial());
        }
        if ($okFilesCreated === 0) {
            throw new \Exception(sprintf('Can\'t find any CSV files in source directory "%s"', $this->getSourceDir()));
        }
    }
public function process ( ) { $ okFilesCreated = 1 ; $ filters = array ( function ( SubjectConfigurationInterface $ subject ) { return $ subject -> isOkFileNeeded ( ) ; } ) ; $ subjects = $ this -> getConfiguration ( ) -> getSubjects ( $ filters ) ; foreach ( $ subjects as $ subject ) { $ okFilesCreated += $ this -> getFileWriterFactory ( ) -> createFileWriter ( $ subject ) -> createOkFiles ( $ this -> getSerial ( ) ) ; } if ( $ okFilesCreated === 0 ) { throw new \ Exception ( sprintf ( 'Can\'t find any CSV files in source directory "%s"' , $ this -> getSourceDir ( ) ) ) ; } }
Process the plugin functionality.
Process the plugin functionality .
// initialize the counter for the CSV files // initialize the subject filter we want to use // load the matching subjects (only that one, that needs an .OK file) // create the .OK files for that subjects // query whether or not we've found any CSV files