Cake\Upgrade\Shell\Task\SkeletonTask::_addFile PHP Method

_addFile() protected method

_addFile()
protected _addFile ( string $file, string $sourcePath, string $targetPath, $targetFile = null ) : boolean
$file string
$sourcePath string
$targetPath string
return boolean
    protected function _addFile($file, $sourcePath, $targetPath, $targetFile = null)
    {
        $result = false;
        if (!is_file($targetPath . $file) || !empty($this->params['overwrite'])) {
            $result = true;
            if (empty($this->params['dry-run'])) {
                if ($targetFile === null) {
                    $targetFile = $file;
                }
                $targetPathName = $targetPath . dirname($targetFile);
                if (!is_dir($targetPathName)) {
                    mkdir($targetPathName, 0755, true);
                }
                $result = copy($sourcePath . $file, $targetPath . $targetFile);
            }
            $this->out('Adding ' . $file, 1, Shell::VERBOSE);
        }
        return $result;
    }