src/Subjects/FileResolver/FileResolverFactory.php
/**
     * Creates and returns the file resolver instance for the subject with the passed configuration.
     *
     * @param \TechDivision\Import\Configuration\SubjectConfigurationInterface $subject The subject to create the file resolver for
     *
     * @return \TechDivision\Import\Subjects\FileResolver\FileResolverInterface The file resolver instance
     */
Creates and returns the file resolver instance for the subject with the passed configuration.
@param \TechDivision\Import\Configuration\SubjectConfigurationInterface $subject The subject to create the file resolver for


Creates and returns the file resolver instance for the subject with the passed configuration . @param \ TechDivision \ Import \ Configuration \ SubjectConfigurationInterface $subject The subject to create the file resolver for
public function createFileResolver(SubjectConfigurationInterface $subject) : FileResolverInterface
    {
        $container = $this->getContainer();
        $handler = $this->getHandlerFactory()->createHandler($subject);
        $filesystemAdapter = $container->get($subject->getFilesystemAdapter()->getId());
        if ($filesystemAdapter instanceof FilesystemAdapterFactoryInterface) {
            $filesystemAdapter = $filesystemAdapter->createFilesystemAdapter($subject);
        }
        $filter = new OkFileFilter($handler, $subject, $this->getSourceDir($filesystemAdapter));
        $filesystemLoader = new FilesystemLoader($filesystemAdapter);
        $filteredLoader = new FilteredLoader($filesystemLoader);
        $pregMatchFilteredloader = new PregMatchFilteredLoader($filteredLoader);
        $pregMatchFilteredloader->addFilter($filter);
        $fileResolver = $container->get($subject->getFileResolver()->getId());
        $fileResolver->setFilesystemAdapter($filesystemAdapter);
        $fileResolver->setSubjectConfiguration($subject);
        $fileResolver->setLoader($pregMatchFilteredloader);
        return $fileResolver;
    }
public function createFileResolver ( SubjectConfigurationInterface $ subject ) : FileResolverInterface { $ container = $ this -> getContainer ( ) ; $ handler = $ this -> getHandlerFactory ( ) -> createHandler ( $ subject ) ; $ filesystemAdapter = $ container -> get ( $ subject -> getFilesystemAdapter ( ) -> getId ( ) ) ; if ( $ filesystemAdapter instanceof FilesystemAdapterFactoryInterface ) { $ filesystemAdapter = $ filesystemAdapter -> createFilesystemAdapter ( $ subject ) ; } $ filter = new OkFileFilter ( $ handler , $ subject , $ this -> getSourceDir ( $ filesystemAdapter ) ) ; $ filesystemLoader = new FilesystemLoader ( $ filesystemAdapter ) ; $ filteredLoader = new FilteredLoader ( $ filesystemLoader ) ; $ pregMatchFilteredloader = new PregMatchFilteredLoader ( $ filteredLoader ) ; $ pregMatchFilteredloader -> addFilter ( $ filter ) ; $ fileResolver = $ container -> get ( $ subject -> getFileResolver ( ) -> getId ( ) ) ; $ fileResolver -> setFilesystemAdapter ( $ filesystemAdapter ) ; $ fileResolver -> setSubjectConfiguration ( $ subject ) ; $ fileResolver -> setLoader ( $ pregMatchFilteredloader ) ; return $ fileResolver ; }
Creates and returns the file resolver instance for the subject with the passed configuration.
Creates and returns the file resolver instance for the subject with the passed configuration .
// load the DI container instance // load the proposed .OK file loader // load the filesystem adapter instance // query whether or not we've a factory instance /** \TechDivision\Import\Adapter\FilesystemAdapterInterface $filesystemAdapter */ // initialize the filter for the files that has to be imported // AND matches the .OK file, if one has been requested // initialize the loader for the files that has to be imported // create a new file resolver instance for the subject with the passed configuration /** @var \TechDivision\Import\Subjects\FileResolver\FileResolverInterface $fileResolver */ // return the file resolver instance