Create file and return it's path or false on failed

@param  string  $path  parent dir path
@param string  $name  new file name
@return string|bool
@author Dmitry (dio) Levashov
492948
protected function _mkfile($path, $name) {
		return $this->make($path, $name, 'text/plain') ? $this->_joinPath($path, $name) : false;
	}
373116
private function createFilePath($path)
    {
        $dir = dirname($path);
        return file_exists($dir) || FileHelper::createDirectory($dir, 0775, true);
    }
1196427
public function createChildFile($name)
    {
        if (
            strpos($name, '\\') !== false
            || strpos($name, '/') !== false
            || strpos($name, '..') !== false
        ) {
            throw new InvalidArgumentException("Wrong file name {$name}");
        }

        $class = $this->fileClass;

        return new $class($this->absolutePath . '/' . $name);
    }
903755
public static function download($path = false, $extension = false, $name = false) {

        File::download($path, $extension, $name);
    }
673671
public function makeDirectory($path)
    {
        event(new Events\DirectoryCreating($path));
        $created = $this->disk()->makeDirectory($path);
        event(new Events\DirectoryCreated($path, $created));

        return $created;
    }
153152
static function createDirectories($path) {

		if (!$path) throw new \InvalidArgumentException("\$path can not be empty.");

		/*
		$parts=explode("/",$path);
		$pathPart="";
		foreach($parts as $i=>$p) {
			if ($i) $pathPart.="/";
			$pathPart.=$p;
			if ($pathPart) {
				if (@file_exists($pathPart) and !is_dir($pathPart)) {
					throw new FileException("\"$pathPart\" is a regular file!");
				}
				if (!(@file_exists($pathPart))) {
					self::mkdir($pathPart,false);
				}
			}
		}
		return $pathPart;
		 *
		 */

		if (file_exists($path)) {
			if (is_dir($path)) {
				return $path;
			}
			throw new FileException("\"$path\" is a regular file!");
		}

		$ret = @mkdir($path, 0777, true);
		if (!$ret) {
			throw new FileException("Directory \"$path\ could not be created.");
		}

		return $path;
	}
260653
public function makeDirectory($path)
    {
        if ('.' === $path || empty($path)) {
            $path = $this->localPath;
        } else {
            $path = "{$this->localPath}/{$path}";
        }

        return $this->filesystem->createDir($path);
    }
331799
public static function mkDir($path)
    {
        if (file_exists($path)) {
            return false;
        }

        $umask = umask();
        $res = @mkdir($path, Constants::FILESYSTEM_DIR_PERMISSIONS_DEFAULT, true);
        if ($res === false) {
            throw new RuntimeException('Can not create directory "' . $path . '" - no permissions.');
        }
        umask($umask);

        return $res;
    }
1320035
public function make($path, $name, array $options = [])
    {
        $options += ['middleware' => null, 'prefix' => null];

        $parsedRoutes = $this->getParsedRoutes($options['middleware'], $options['prefix']);

        $template = $this->file->get(__DIR__ . '/templates/Router.js');

        $template = str_replace("routes: null,", 'routes: ' . json_encode($parsedRoutes) . ',', $template);
        $template = str_replace("'Router'", "'" . $options['object'] . "'", $template);

        if ($this->file->isWritable($path)) {
            $filename = $path . '/' . $name;

            return $this->file->put($filename, $template) !== false;
        }

        return false;
    }
1372266
protected function createFileDir($path)
    {
        if (!file_exists($path)) {
            $this->createFileDir(dirname($path));
            mkdir($path, 0777);
        }
    }
808103
protected function _mkdir($path, $name) {
		return $this->make($path, $name, 'directory') ? $this->_joinPath($path, $name) : false;
	}
716954
private function makePath($path)
    {
        $path = dirname($path);
        if (!is_dir($path) && !mkdir($path, 0700, true)) {
            throw new MkdirErrorException(Lang::get('_CREATE_DIR_ERROR_') . "[{$path}]");
        }
        return true;
    }
1350094
public function subtree($path, &$name, $create = false)
  {
    $parts = $this->split($path);

    $_name = array_shift($parts);
    if (!sizeof($parts)) {
      $name = $_name;
      $subtree = $this;
    } else {

      $exists = isset($this->_subTrees[$_name]);
      if (!$exists && !$create) {
        $subtree = null;
        $name = null;
      } else {
        if (!$exists && $create) {
          $this->_subTrees[$_name] = new self();
        }
        $subtree = $this->_subTrees[$_name]->subtree($parts, $name, $create);
      }

    }
    return $subtree;
  }
1150335
public function makeDir($path)
    {
        if (empty($path)) return false;
        $dir = explode("/", $path);
        $path = ftp_pwd($this->linkid) . '/';
        $ret = true;
        for ($i=0; $i<count($dir); $i++) {
            $path = $path . $dir[$i] . '/';
            if (!@ftp_chdir($this->linkid, $path)) {
                if (!@ftp_mkdir($this->linkid, $dir[$i])) {
                    $ret = false;
                    break;
                }
            }
            @ftp_chdir($this->linkid, $path);
        } 
        if (!$ret) return false;
        return true;
    }
508540
public function newFileFromName($path, $name, $hashName = false){
        $info = pathinfo($name);
        $ext = isset($info['extension'])? ".{$info['extension']}":"";
        $name = $info['filename'];
        $n = $hashName?md5($name):$name;
        $file = new FileImpl("$path/$n$ext");
        $i = 0;
        while($file->exists()){
            $i++;
            $n = $hashName?md5($name.$i):"$name ($i)";
            $file = new FileImpl("$path/$n$ext");
        }
        return $file;

    }
76366
private function getUniqueFileName($path, $name, $ext = null)
    {
        $originalName = $name;
        $i = 0;

        do {
            $fullPath = $path . '/' . $name . ($ext ? '.' . $ext : '');
        } while ($this->storage->exists($fullPath) && $name = $originalName . '-' . ++$i);

        return $name;
    }
169033
public function save(string $path, string $name, ?string $extension = null, int $quality = 100): bool
    {
        if (false === is_dir($path)) {
            mkdir($path, 0777, true);
        }
        if (null === $extension) {
            /** @var string $extension */
            $extension = $this->extension;
        }
        if (true === $this->encrypted) {
            file_put_contents($path . $name . '.' . self::FORMAT_WD_IMAGE, $this->workingData);
            return true;
        } elseif (0 !== imagetypes()) {
            $filename = $path . $name . '.' . $extension;
            switch (strtolower($extension)) {
                case self::FORMAT_GIF:
                    imagegif($this->workingData, $filename);
                    break;
                case self::FORMAT_JPEG:
                case self::FORMAT_JPG:
                    imagejpeg($this->workingData, $filename, $quality);
                    break;
                case self::FORMAT_PNG:
                    imagepng($this->workingData, $filename, (int)round(9 - ((9 * $quality) / 100)));
                    break;
                default:
                    throw new ImageException('Unsupported file type');
            }
            return false;
        }
    }