{@inheritdoc}
@param string $target Directory

@throws UnableToWriteSpecificationException
480336
public function write(SpecificationRepresentationInterface $specificationRepresentation, $target)
    {
        $this->guardAgainstEmptyTarget($target);

        $renderedSpecification = $specificationRepresentation->render();

        $this->guardAgainstEmptyRenderedSpecification($target, $renderedSpecification);

        $this->createDirectoryIfNotExist($target);

        $result = file_put_contents(
            $target,
            $specificationRepresentation->render()
        );

        $this->guardAgainstNotWrittenSpecification($target, $result);
    }
1058347
public function exposeDirectory($source, $target)
    {
        $lastException = null;
        foreach ($this->failovers as $failover) {
            try {
                $failover->exposeDirectory($source, $target);
                return; // Return on first success
            } catch (RuntimeException $lastException) {
            }
        }
        if ($lastException) {
            throw $lastException;
        }
    }
311853
public function setTarget($target)
    {
        if (!$target instanceof ModelInterface) {
            throw new Exception\InvalidArgumentException(sprintf(
                '"%s" works only with ModelInterface targets',
                __CLASS__
            ));
        }
        return parent::setTarget($target);
    }
642858
public function moveTo(string $target): ?string
    {
        $ret = $this->handle->rpoplpush($this->name, $target);
        return (false === $ret) ? null : $ret;
    }
1272235
public function setTemplateDir($dir)
    {
        $tmpDir = rtrim($dir, '/\\') . DIRECTORY_SEPARATOR;
        if (is_dir($tmpDir) === false) {
            throw new Exception('The template directory: "' . $tmpDir . '" does not exists, create the directory or specify an other location !');
        }
        $this->templateDir[] = $tmpDir;
    }
1175401
public function copy($target, $source)
    {
        if (!$this->exists($target)) {
            throw new \RuntimeException("$target does not exist.", E_ERROR);
        }

        if (!$this->exists($source)) {
            $this->makeDirectory(dirname($source), true);
        }

        return file_put_contents($source, $this->get($target));
    }
1161159
public function setRenderer(int $target, RendererInterface $renderer): Dumper
    {
        if (!isset($this->targets[$target])) {
            throw new DumperException(sprintf("Undefined dump target %d", $target));
        }

        $this->targets[$target] = $renderer;

        return $this;
    }
842104
public function setTarget($target)
    {
        if (Format::isIdentifier($target)) {
            $this->target = $target;
        } else {
            $msg = "'${target}' is not a valid QTI identifier.";
            throw new InvalidArgumentException($msg);
        }
    }
1039192
public function setTargetDir ($dir)
		{
			$this->_targetDir = $dir;
			if (!is_dir($this->_targetDir))
				FileHelper::createDirectory($this->_targetDir);
		}
653368
protected function get_target_suffix($target) {
        if (empty($target) || $target === RENDERER_TARGET_MAINTENANCE) {
            // If the target hasn't been specified we need to guess the defaults.
            // We also override the target with the default if the maintenance target has been provided.
            // This ensures we don't use the maintenance renderer if we are processing a special target.
            if (defined('PREFERRED_RENDERER_TARGET')) {
                $target = PREFERRED_RENDERER_TARGET;
            } else if (CLI_SCRIPT) {
                $target = RENDERER_TARGET_CLI;
            } else if (AJAX_SCRIPT) {
                $target = RENDERER_TARGET_AJAX;
            }
        }

        switch ($target) {
            case RENDERER_TARGET_CLI: $suffix = '_cli'; break;
            case RENDERER_TARGET_AJAX: $suffix = '_ajax'; break;
            case RENDERER_TARGET_TEXTEMAIL: $suffix = '_textemail'; break;
            case RENDERER_TARGET_HTMLEMAIL: $suffix = '_htmlemail'; break;
            case RENDERER_TARGET_MAINTENANCE: $suffix = '_maintenance'; break;
            default: $target = RENDERER_TARGET_GENERAL; $suffix = '';
        }

        return array($target, $suffix);
    }
378285
protected function copyDirectory($source, $target)
    {
        new Rah_Eien_Action_Stat($source, 'rd');
        new Rah_Eien_Action_Stat($target, 'wd');

        $files = new RecursiveDirectoryIterator($source);
        $file = new RecursiveIteratorIterator($files, RecursiveIteratorIterator::SELF_FIRST);

        while ($file->valid())
        {
            if ($file->isDot() === false)
            {
                $name = $target.'/'.$file->getSubPathName();

                if ($file->isDir())
                {
                    if (@mkdir($name) === false)
                    {
                        throw new Rah_Eien_Exception('Unable to create a directory: '.$name);
                    }
                }
                else
                {
                    $this->copyFile($file->getPathname(), $name);
                }
            }

            $file->next();
        }
    }
1079629
public function clover(string $target)
    {
        $clover = new Clover();
        $clover->process($this->coverage, $target);
    }
198920
private function canAddTarget($target, $mode)
    {
        // Mode is set to ignore existing targets
        if ($mode === self::DUPLICATE_IGNORE) {
            return false;
        }

        // Error if we're not allowed to overwrite or can't remove the existing target
        if ($mode !== self::DUPLICATE_OVERWRITE || !$this->filesystem->remove($target)) {
            throw new \RuntimeException(sprintf('Installation target "%s" already exists', $target));
        }

        return true;
    }
510535
public function canExtract($source, $target, ExtractionContextInterface $extractionContext)
    {
        if (!$target instanceof SupportedTarget) {
            return false;
        }

        if (is_null(self::getPrimitiveType($source))) {
            return false;
        }

        return true;
    }
1247549
protected function copy($source, $target): void
    {
        // skip, if not exists
        if (!file_exists($source)) {
            return;
        }
        // skip, if target exists
        if (is_file($target) && !is_dir($target)) {
            $this->installer->getIo()->write(
                sprintf('  - File <comment>%s</comment> already exists', $target),
                true,
                IOInterface::VERBOSE
            );
            return;
        }

        // Check the renaming of file for direct moving (file-to-file)
        $isRenameFile = substr($target, -1) !== '/' && !is_dir($source);

        if (file_exists($target) && !is_dir($target) && !$isRenameFile) {
            throw new \InvalidArgumentException('Destination directory is not a directory');
        }

        try {
            if ($isRenameFile) {
                $this->getFilesystem()->mkdir(\dirname($target));
            } else {
                $this->getFilesystem()->mkdir($target);
            }
        } catch (IOException $e) {
            throw new \InvalidArgumentException(
                sprintf('Could not create directory `%s`', $target)
            );
        }

        if (false === file_exists($source)) {
            throw new \InvalidArgumentException(
                sprintf('Source directory or file `%s` does not exist', $source)
            );
        }

        if (is_dir($source)) {
            $finder = new Finder;
            $finder->files()->in($source);

            foreach ($finder as $file) {
                try {
                    $this->getFilesystem()->copy($file, $target . DS . $file->getRelativePathname());
                } catch (IOException $e) {
                    throw new \InvalidArgumentException(
                        sprintf('Could not copy `%s`', $file->getBaseName())
                    );
                }
            }
        } else {
            try {
                if ($isRenameFile) {
                    $this->getFilesystem()->copy($source, $target);
                } else {
                    $this->getFilesystem()->copy($source, $target . '/' . basename($source));
                }
            } catch (IOException $e) {
                throw new \InvalidArgumentException(sprintf('Could not copy `%s`', $source));
            }
        }

        $this->installer->getIo()->write(
            sprintf('  - Copied file(s) from <comment>%s</comment> to <comment>%s</comment>', $source, $target),
            true,
            IOInterface::VERBOSE
        );
    }
945756
public function copy($target) {
        if (!parent::copy($target))
            return false;
        return file_put_contents($target, $this->content) !== false;
    }
364819
public function copyDirs($source, $target, $dirs)
    {
        foreach ($dirs as $dir) {
            $this->copyDir($source, $target, $dir);
        }
    }