Airship\Hangar\Commands\Assemble::copyFile PHP Method

copyFile() protected method

Copy a file from one directory to another, ensuring that the destination directory exists.
protected copyFile ( string $from, string $to, string $filename ) : boolean
$from string
$to string
$filename string
return boolean
    protected function copyFile(string $from, string $to, string $filename) : bool
    {
        $acc = '';
        $exploded = \explode(DIRECTORY_SEPARATOR, \trim(\dirname($to . DIRECTORY_SEPARATOR . $filename), DIRECTORY_SEPARATOR));
        foreach ($exploded as $piece) {
            $acc .= DIRECTORY_SEPARATOR . $piece;
            if (!\is_dir($acc)) {
                \mkdir($acc, 0755);
            }
        }
        return \copy($from . DIRECTORY_SEPARATOR . $filename, $to . DIRECTORY_SEPARATOR . $filename);
    }