Build an unique file and update the manifest

@param string $file Name of the file relative to public path.
544207
private function buildUniqueFile($file)
    {
        // be sure the folder public/build is exist
        $dir = public_path('build');
        if (!file_exists($dir)) {
            if (!make_dir($dir, 0755)) { // @codeCoverageIgnore
                throw new RuntimeException('Unable to create directory ' . $dir); // @codeCoverageIgnore
            } // @codeCoverageIgnore
        }

        // be sure the manifest path is exist
        $dir = dirname($this->manifestFile);
        if (!file_exists($dir)) {
            if (!make_dir($dir, 0755)) {
                throw new RuntimeException('Unable to create directory ' . $dir); // @codeCoverageIgnore
            }
        }

        // generate unique file
        $ext = pathinfo($file, PATHINFO_EXTENSION);
        $uniqueFile = 'build/' . basename($file, '.' . $ext) . '-' . uniqid() . '.' . $ext;
        copy(public_path($file), public_path($uniqueFile));

        // update manifest
        $oldFile = isset($this->manifest[$file]) ? public_path($this->manifest[$file]) : null;
        $this->manifest[$file] = $uniqueFile;
        if (file_put_contents($this->manifestFile, '<?php return ' . var_export($this->manifest, true) . ';' . PHP_EOL, LOCK_EX) === false) {
            throw new RuntimeException(sprintf('Asset Manager was not able to save manifest file "%s"', $this->manifestFile)); // @codeCoverageIgnore
        }

        // delete old unique file
        if ($oldFile !== null && file_exists($oldFile)) {
            unlink($oldFile);
        }
    }
38580
public function init($file)
	{
		try {
			
			$this->load($file);

		} catch (Exceptions\FileNotExists $e) {

			$this->create($file);
		}
	}
808637
public function make($file, $content)
    {
        if ( $this->exists($file))
        {
            throw new FileAlreadyExists;
        }
        $this->put($file, $content);
    }
535282
protected function load(string $file): void
	{
		$this->configuration[$file] = $this->loader->load($file, $this->environment);
	}
1268495
public static function createFromFile($file)
    {
        // If the file is not readable
        if (!is_readable($file)) {
            throw new InvalidArgumentException(
                sprintf(InvalidArgumentException::INVALID_FILE_STR, $file),
                InvalidArgumentException::INVALID_FILE
            );
        }

        return self::createFromString(file_get_contents($file));
    }
1258586
private function loadFile ($file)
	{
		if (!isset ($this->files[$file]))
		{
			$filename = $this->folder . $file . '.php';

			// First load these
			if (file_exists ($filename))
			{
				$this->files[$file] = include ($filename);
			}

			// Now overload with environment values
			if (isset ($this->environment))
			{
				$filename = $this->folder . $this->environment . '/' . $file . '.php';
				if (file_exists ($filename))
				{
					$this->merge ($file, include ($filename));
				}
			}

		}
	}
885322
protected function loadFile($file)
    {
        $requiredFiles = $this->getRequiredFiles($file);
        $this->values[$file] = true;

        foreach ($requiredFiles as $fileToRequire) {
            $overrideConfig = require $fileToRequire['path'];
            $this->config->addConfig([$file => $overrideConfig], $fileToRequire['environment']);
        }
    }
1038040
protected function setFilePath(string $file)
    {
        if (!$this->isFileReadable($file)) {
            if (!file_exists($file)) {
                throw new SourceUnavailableException("File '$file' does not exist.", 1458977223);
            } else {
                throw new SourceUnavailableException("File '$file' exists but is not readable.", 1458977224);
            }
        }
        $this->file = $file;
    }
865878
public function setFile($file = null)
    {
        if (is_null($file)) {
            $this->file = ['name' => date('Ymd-His'), 'part' => 1];
        } else {
            if (!array_key_exists("name", $file) && !array_key_exists("part", $file)) {
                $this->file = $file['1'];
            } else {
                $this->file = $file;
            }
        }
        return $this;
    }
1080745
public static function setFile($file)
    {
      $rf = realpath($file);
      if (is_file($rf))
        throw new \CatapultApiException("File provided does not exist..");  

      self::$credentials_opts['file'] = realpath($file);
    }
1240395
public function copy($file)
    {
        $fs = new Filesystem;

        if (! $fs->exists(dirname($file))) {
            $fs->mkdir(dirname($file), 0755);
        }

        $fs->copy($this->source, $file, true);
    }
987077
protected function runDeploy($file)
    {
        $deploy = $this->resolve($name = $this->getDeployName($file));

        $this->note("<comment>Deploying:</comment> {$name}");

        // Run deploy
        $deploy->run();

        $this->note("<info>Deployed:</info>  {$name}");
    }
1080398
protected function loadLayoutUpdate($file)
    {
        $update = $this->loader->load($file);
        if ($update) {
            $el = $update instanceof ElementDependentLayoutUpdateInterface
                ? $update->getElement()
                : 'root';
            $this->updates[$el][] = $update;

            $this->dependencyInitializer->initialize($update);
        }
    }
1075508
public function copyToAppliedDir($file)
    {
        if (false === @copy($file->getPathName(), $this->appliedFilesDir . '/' . $file->getFileName())) {
            throw new RuntimeException('cannot copy the sql file to applied directory. check the <info>'. $this->appliedFilesDir . '</info> directory.');
        }
    }
888943
protected static function setFile($file)
    {
        if (self::$isCom === false) {
            $incFile = route()->views.'/'.$file.'.php';
            if (file_exists($incFile)) {
                self::$file = $incFile;
            }
        } else {
            $incFile = route()->com.$file.'.php';
            if (file_exists($incFile)) {
                self::$file = $incFile;
            }
        }
    }
151568
protected function addFile(File $file) {
        $files = $this->getFiles();
        $files[$file->getName()] = $file;
        $this->setFiles($files);
    }
1166272
public function setFile($file) {
        if (!file_exists($file) || !is_readable($file)) {
            throw new InvalidArgumentException("The file '{$file}' cannot be opened.");
        }
        $this->file = $file;
        return $this;
    }