Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Oct 10, 2018
1 parent 92df3c1 commit 98b8256
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
17 changes: 11 additions & 6 deletions src/Illuminate/Filesystem/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,26 +128,31 @@ public function put($path, $contents, $lock = false)
*
* This will also replace the target file permissions.
*
* @param string $path
* @param string $content
* @throws Exception
* @param string $path
* @param string $content
* @return void
*
* @throws \Exception
*/
public function replace($path, $content)
{
// Just in case path already exists and is a symlink, we want to make sure we get the real path.
// If the path already exists and is a symlink, make sure we get the real path...
clearstatcache(true, $path);

$realPath = realpath($path);

if ($realPath) {
$path = $realPath;
}

$dirName = dirname($path);

if (! is_writable($dirName)) {
throw new Exception("Replacing $path requires it's parent directory to be writable.");
throw new Exception("Replacing [{$path}] requires that its parent directory is writable.");
}

// Write out the contents to a temp file, so we then can rename the file atomically.
$tempPath = tempnam($dirName, basename($path));

file_put_contents($tempPath, $content);

rename($tempPath, $path);
Expand Down
5 changes: 4 additions & 1 deletion src/Illuminate/Foundation/PackageManifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ protected function packagesToIgnore()
*/
protected function write(array $manifest)
{
$this->files->replace($this->manifestPath, '<?php return '.var_export($manifest, true).';');
$this->files->replace(
$this->manifestPath,
'<?php return '.var_export($manifest, true).';'
);
}
}

0 comments on commit 98b8256

Please sign in to comment.