{@inheritdoc}

@throws \Gush\Exception\FileNotFoundException
494790
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $adapter = $this->getAdapter();
        $releaseName = $input->getOption('name');
        $tag = $input->getArgument('tag');
        $org = $input->getOption('org');
        $repo = $input->getOption('repo');
        $assetFiles = $input->getOption('asset-file');
        $assetNames = $input->getOption('asset-name');
        $assetContentTypes = $input->getOption('asset-content-type');

        if ($input->getOption('replace')) {
            $this->removeExisting($adapter, $tag);
        }

        // validates assets
        foreach ($assetFiles as $assetFile) {
            if (!file_exists($assetFile)) {
                throw new FileNotFoundException(sprintf('Asset "%s" does not exist', $assetFile));
            }
        }

        $output->writeln(
            sprintf(
                ' <info>Creating release %s for </info>%s<info> on </info>%s<info>/</info>%s',
                $releaseName ?: $tag,
                $tag,
                $org,
                $repo
            )
        );

        $release = $adapter->createRelease(
            $input->getArgument('tag'),
            [
                'target_commitish' => $input->getOption('target-commitish'),
                'name' => $input->getOption('name'),
                'body' => $input->getOption('body'),
                'draft' => $input->getOption('draft'),
                'prerelease' => $input->getOption('prerelease'),
            ]
        );

        $this->getHelper('gush_style')->success(
            sprintf('Created release with ID %s', $release['id'])
        );

        foreach ($assetFiles as $i => $assetFile) {
            $output->writeln(
                sprintf('<info>Uploading asset </info>%s"', $assetFile)
            );

            if (isset($assetNames[$i])) {
                $assetName = $assetNames[$i];
            } else {
                $assetName = basename($assetFile);
            }

            if (isset($assetContentTypes[$i])) {
                $assetContentType = $assetContentTypes[$i];
            } else {
                $assetContentType = 'application/zip';
            }

            $content = file_get_contents($assetFile);
            $adapter->createReleaseAssets(
                $release['id'],
                $assetName,
                $assetContentType,
                $content
            );
        }

        return self::COMMAND_SUCCESS;
    }
606318
public function setFiles(array $files)
    {
        foreach($files as $file) {
            if (!$file instanceof File) {
                throw new ObjectNotAFileException($file . ' is not a file');
            }
        }

        $this->files = $files;
        return $this;
    }
3073
public function cat($path)
    {
        if (!$this->hasCheckout) {
            $this->checkout();
        }

        if (false === file_exists($this->cwd . '/' . $path)) {
            throw new NotFoundException(sprintf('The path \'%s\' is not found', $path));
        }

        return file_get_contents($this->cwd . '/' . $path);
    }
637765
public function setDir($dir)
    {
        if (!is_dir($dir)) {
            throw new FileNotFoundException(sprintf('Config "%s" is not a directory.', is_string($dir) ? $dir : (is_object($dir) ? get_class($dir) : gettype($dir))));
        }

        $newDir = realpath($dir).'/';
        if (null === $this->configDirectory) {
            $this->configDirectory = $newDir;

            return $this;
        }

        if ($newDir === $this->configDirectory) {
            return $this;
        }

        $this->configDirectory = $newDir;
        $this->flushAll();

        return $this;
    }
350896
public function watermark(string $filePath)
    {
        if (! file_exists($filePath)) {
            throw new FileNotFoundException($filePath);
        }

        $this->addManipulation('watermark', $filePath);

        return $this;
    }
1201017
public function loadSchema($filename)
    {
        if (!file_exists($filename)) {
            throw new FileNotFoundException($filename);
        }

        $xml = simplexml_load_file($filename);

        $tables = $this->loadTables($xml->xpath('//table'));
        return new Schema($tables);
    }
145230
private function fig_cdata(Context $context) {
        $filename = $this->dataFile;
        $realfilename = dirname($context->getFilename()).'/'.$filename;
        if(! file_exists($realfilename)) {
            $message = "File not found: $filename called from: " . $context->getFilename(). '(' . $this->xmlLineNumber . ')';
            throw new FileNotFoundException($message, $filename);
        }
        $cdata = file_get_contents($realfilename);
        return $cdata;
    }
1004238
protected function loadWorkflow($workflowName)
    {
        $workflowFile = "{$this->workflowPath}/{$workflowName}.yml";
        if (!file_exists($workflowFile)) {
            throw new FileNotFoundException("The workflow configuration file {$workflowName}.yml doesn't exist.");
        }

        $yamlParser = new Parser();

        $workflowConfiguration = $yamlParser->parse(file_get_contents($workflowFile));
        $workflow = new Workflow($workflowName);

        foreach ($workflowConfiguration['tasks'] as $name => $serviceId)
        {
            $workflow->setTask($name, new Task($name, $serviceId));
        }

        $this->workflows[$workflowName] = $workflow;
    }
545934
public function size($filename)
    {
        if ($this->exists($filename) && $this->isFile($filename)) {
            return filesize($filename);
        }
        throw new FileNotFoundException('File not found in the path [ ' . $filename . ' ].');
    }
1100319
public function loadFromFile($path)
    {
        // the file should exists
        $fileSystem = new Filesystem();

        if (!$fileSystem->exists($path)) {
            throw new FileNotFoundException();
        }
        // the file should be a yml file
        $configurationFile = new SplFileInfo($path);

        if ($configurationFile->getExtension() !== 'yml') {
            throw new Exception('Only yml are allowed for assets configuration loading');
        }
        // parse configuration using Symfony processor
        $configuration = Yaml::parse(file_get_contents($path));
        $configurationDI = new Configuration();
        $processor = new Processor();

        return $processor->processConfiguration($configurationDI, $configuration);
    }
66699
public function build(): Source
    {
        if (!\file_exists($this->filePath) || !\is_readable($this->filePath)) {
            throw new FileNotFoundException(sprintf('The file %s cannot be found or is not readable', $this->filePath));
        }

        return new Source(\file_get_contents($this->filePath));
    }
903160
public static function load($path, $loadOnce = true)
    {
        if (!self::loadIfExists($path, $loadOnce)) {
            throw new FileNotFoundException('Cannot load file: ' . $path);
        }
    }
361851
public function setImageFile($imageFilePath)
    {
        if ( ! $this->driver->setSourceImage($imageFilePath)) {
            throw new FileNotFoundException('IMAGE_E_FILE_NOT_FOUND', 0, [$imageFilePath]);
        }

        // Create image source resource
        $this->driver->createFromSource();

        return $this;
    }
85075
public function generateFromConfigFile(string $configPath)
    {
        try {
            $fileSystem = new Filesystem();
            if (!$fileSystem->exists($configPath)) {
                throw new FileNotFoundException(sprintf('The file %s does not exist.', $configPath));
            }

            $faviconRequestPath = $this->cwd.'/faviconRequest.json';
            $fileSystem = new Filesystem();
            if (!$fileSystem->exists($faviconRequestPath)) {
                $fileSystem->copy($configPath, $faviconRequestPath);
            }
            $this->process = new Process(sprintf(
                '%s %s generate %s %s %s',
                $this->nodePath,
                $this->realFaviconPath,
                $configPath,
                $faviconRequestPath,
                $this->target
            ), $this->cwd);
            $this->process->mustRun();

            $response = json_decode(file_get_contents($faviconRequestPath));
            if ($response->result->status === 'success') {
                $fileSystem->remove($faviconRequestPath);
                $files = [];
                foreach ($response->favicon->files_urls as $file) {
                    $path = parse_url($file, PHP_URL_PATH);
                    $pathFragments = explode('/', $path);
                    $files[] = sprintf('%s/%s', $this->target, end($pathFragments));
                }

                return $files;
            }

            throw new GenerateFaviconException(
                sprintf(
                        'An issue occured with the real favicon generation, you can dive into the %s file',
                        $faviconRequestPath
                    )
                );
        } catch (FileNotFoundException | ProcessFailedException $e) {
            throw $e;
        }
    }
1158804
public function loadFile($filename) {
		$this->filename = $filename;


		// If a cache directory was specified,
        // try to load from it
		if ($this->cachePath) {
		    if (! $this->templatesRoot) {
		        $this->templatesRoot = dirname($filename);
            }
		    $cacheFile = $this->makeCacheFilename($this->cachePath, $this->templatesRoot, $this->filename);
            if ( file_exists($cacheFile)
                 && (! file_exists($this->filename) || (filemtime($this->filename) < filemtime($cacheFile)) )
            ) {
                $this->loadFromSerialized(file_get_contents($cacheFile));
                return;
            }
        }

		if(file_exists($filename)) {
			$this->source = file_get_contents($filename);
		} else {
			$message = "File not found: $filename";
			throw new FileNotFoundException($message, $filename);
		}
	}
814289
public function lastModified($name)
    {
        if (! $this->files->exists($name)) {
            throw new FileNotFoundException("$name does not exist");
        }
        return $this->files->lastModified($name);
    }
1155621
protected function loadRecipeFile($filename) {
    if (!file_exists($filename)) {
      throw new FileNotFoundException($filename);
    }
    $recipe = Yaml::parse(
      file_get_contents($filename)
    );
    $configs = [$recipe];
    $processor = new Processor();
    $configuration_tree = new ProjectConfiguration();
    $processed_configuration = $processor->processConfiguration(
      $configuration_tree,
      $configs
    );

    return $processed_configuration;
  }