{@inheritdoc}

@return FileInterface
346020
public function create()
    {
        $file = $this->ensureEloquentFile($this->nodeRepository->make());
        $this->callBeforeListeners('create', [$file]);
        $this->callAfterListeners('create', [$file]);
        return $file;
    }
500616
public function create(): ConfigurationInterface
    {
        $config = $this->detectConfig();
        $config->set('env', $this->environment);

        return $config;
    }
1157800
private function fileBuild()
    {
        if (!$this->contactClient || !$this->file) {
            return $this;
        }

        if ($this->test) {
            return $this->fileBuildTest();
        }

        $filter            = [];
        $filter['force'][] = [
            'column' => 'q.contactClient',
            'expr'   => 'eq',
            'value'  => (int) $this->contactClient->getId(),
        ];
        $filter['force'][] = [
            'column' => 'q.file',
            'expr'   => 'eq',
            'value'  => (int) $this->file->getId(),
        ];

        $queues = $this->getQueueRepository()->getEntities(
            [
                'filter'        => $filter,
                'iterator_mode' => true,
            ],
            ['id' => 'ASC']
        );

        $this->count           = 0;
        $queueEntriesProcessed = [];
        while (false !== ($queue = $queues->next())) {
            /** @var Queue $queueEntry */
            $queue         = reset($queue);
            $this->contact = null;
            try {
                // Get the full Contact entity.
                $contactId = $queue->getContact();
                if ($contactId) {
                    $this->contact = $this->contactModel->getEntity($contactId);
                }
                if (!$this->contact) {
                    throw new ContactClientException(
                        'This contact appears to have been deleted: '.$contactId,
                        Codes::HTTP_GONE,
                        null,
                        Stat::TYPE_REJECT,
                        false
                    );
                }

                // Apply the event for configuration/overrides.
                $eventId = $queue->getCampaignEvent();
                if ($eventId) {
                    $event = $this->eventModel->getEntity((int) $eventId);
                    if ($event) {
                        $event = $event->getProperties();
                        // This will apply overrides.
                        $this->setEvent($event);
                    }
                }

                // Get tokenized field values (will include overrides).
                $fieldValues = $this->getFieldValues();
                $this->fileAddRow($fieldValues);

                $queueEntriesProcessed[] = $queue->getId();
            } catch (\Exception $e) {
                // Cancel this contact and any attribution applied to it.
                $this->setLogs($e->getMessage(), 'error');
                $attribution = $queue->getAttribution();
                if (!empty($attribution)) {
                    $attributionChange   = $attribution * -1;
                    $originalAttribution = $this->contact->getAttribution();
                    $newAttribution      = $originalAttribution + $attributionChange;
                    $this->contact->addUpdatedField('attribution', $newAttribution, $originalAttribution);
                    $this->setLogs($attributionChange, 'attributionCancelled');
                    try {
                        $utmSource = $this->utmSourceHelper->getFirstUtmSource($this->contact);
                    } catch (\Exception $e) {
                        $utmSource = null;
                    }
                    $this->contactClientModel->addStat(
                        $this->contactClient,
                        Stat::TYPE_CANCELLED,
                        $this->contact,
                        $attributionChange,
                        $utmSource
                    );
                }
            }

            if ($this->contact) {
                $this->em->detach($this->contact);
            }
            $this->em->detach($queue);
            unset($queue, $contact);
        }
        unset($queues);

        $this->fileClose();
        if ($this->count) {
            $this->fileCompress();
            $this->fileMove();
            $this->fileEntityRefreshSettings();
            $this->fileEntityAddLogs();
            $this->fileEntitySave();
            $this->getQueueRepository()->deleteEntitiesById($queueEntriesProcessed);
        } else {
            $this->setLogs('No applicable contacts were found, so no file was generated.', 'notice');
        }

        return $this;
    }
546731
public function withFile($file)
    {
        if (!is_file($file)) {
            throw new \InvalidArgumentException('File: ' . $file . ' not exists.');
        }

        return $this->withFileStream(new Stream($file));
    }
561518
public function getFileLoader(): LoaderInterface
    {
        if (!isset($this->fileLoader)) {
            $this->fileLoader = new DelegateLoader();
        }

        return $this->fileLoader;
    }
1362292
public function findFiles(FileNodeCollectionInterface $files)
    {
        return $files->filter(function (FileNode $file) {
            $metadata = $file->getMetadata();
            if ($metadata) {
                return ($this->filter->matches($file->getMetadata()));
            } else {
                return false;
            }
        });
    }
585753
public function getDirectory(): FilePathInterface
    {
        return new self($this->myIsAbsolute, $this->myAboveBaseLevel, $this->myDrive, $this->myDirectoryParts, null);
    }
860206
public function fromFileSource(FileSourceInterface $fileSource)
    {
        if ($fileSource instanceof PathSourceInterface) {
            return $this->fromPath($fileSource->getPath());
        }

        throw new RuntimeException('Unsupported file source');
    }
606829
public function setFile($file): self
    {
        $this->file = $file;

        if (is_string($file)) {
            $this->pathToFile = $file;
            $this->setFileName(pathinfo($file, PATHINFO_BASENAME));
            $this->mediaName = pathinfo($file, PATHINFO_FILENAME);

            return $this;
        }

        if ($file instanceof UploadedFile) {
            $this->pathToFile = $file->getPath().'/'.$file->getFilename();
            $this->setFileName($file->getClientOriginalName());
            $this->mediaName = pathinfo($file->getClientOriginalName(), PATHINFO_FILENAME);

            return $this;
        }

        if ($file instanceof SymfonyFile) {
            $this->pathToFile = $file->getPath().'/'.$file->getFilename();
            $this->setFileName(pathinfo($file->getFilename(), PATHINFO_BASENAME));
            $this->mediaName = pathinfo($file->getFilename(), PATHINFO_FILENAME);

            return $this;
        }

        throw UnknownType::create();
    }
1275460
public function file(string $name): ?UploadedFileInterface
    {
        $array = $this->serverRequest->getUploadedFiles();

        return $array[$name] ?? Arrays::get($array, $name);
    }
1078021
public function fromStream(FilesystemStreamInterface $stream)
    {
        if (!$stream->isReadable()) {
            throw new \RuntimeException('Stream not readable');
        }

        $mimetype = null;

        foreach (array_reverse($this->__resolvers) as $name => $resolver)
        {
            //Lazy create the resolver
            if(!($resolver instanceof FilesystemMimetypeInterface))
            {
                $resolver = $this->getObject($resolver);

                if (!$resolver instanceof FilesystemMimetypeInterface) {
                    throw new \UnexpectedValueException('Resolver does not implement FilesystemMimetypeInterface');
                }

                $this->__resolvers[$name] = $resolver;
            }

            /* @var $resolver FilesystemMimetypeInterface */
            if (null !== $mimetype = $resolver->fromStream($stream)) {
                break;
            }
        }

        return $mimetype;
    }
154472
public static function fromFile(string $filename): PhpInterface {
		$interface = new PhpInterface();
		$parser = new FileParser($filename);
		$parser->addVisitor(new InterfaceParserVisitor($interface));
		$parser->addVisitor(new MethodParserVisitor($interface));
		$parser->addVisitor(new ConstantParserVisitor($interface));
		$parser->parse();

		return $interface;
	}
1317184
protected function extractFile(InputInterface $input)
    {
        $resource = STDOUT;
        if (null !== $file = $input->getArgument('file')) {
            if (false === $resource = fopen($file, 'w')) {
                return null;
            }
        }

        return $resource;
    }
417742
public function setFile(\Enhavo\Bundle\MediaBundle\Model\FileInterface $file = null)
    {
        $this->file = $file;

        return $this;
    }
696123
protected function getFileRepository()
    {
        if (null === $this->fileRepository) {
            $this->fileRepository = new FileRepository($this->getConnection());
        }

        return $this->fileRepository;
    }
644719
public function file( $file = null )
	{
		if ( !is_null( $file ) )
		{
			return $this->_file = $file;
		}
		
		return $this->_file;
	}
428984
public function build(): SetFileInputFilesRequest
	{
		$instance = new SetFileInputFilesRequest();
		if ($this->files === null) {
			throw new BuilderException('Property [files] is required.');
		}
		$instance->files = $this->files;
		$instance->nodeId = $this->nodeId;
		$instance->backendNodeId = $this->backendNodeId;
		$instance->objectId = $this->objectId;
		return $instance;
	}