Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Signed-off-by: Mior Muhammad Zaki <[email protected]>
  • Loading branch information
crynobone committed Nov 7, 2023
1 parent f6294c7 commit b67bd09
Showing 1 changed file with 1 addition and 22 deletions.
23 changes: 1 addition & 22 deletions src/Composer.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,5 @@

class Composer extends \Illuminate\Support\Composer
{
/**
* Modify composer content.
*
* @param callable(array):array $callback
*/
public function modify(callable $callback): void
{
$composerFile = "{$this->workingPath}/composer.json";

if (! file_exists($composerFile)) {
throw new RuntimeException("Unable to locate `composer.json` file at [{$this->workingPath}].");
}

$composer = json_decode((string) file_get_contents($composerFile), true, 512, JSON_THROW_ON_ERROR);

$composer = \call_user_func($callback, $composer);

file_put_contents(
$composerFile,
json_encode($composer, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR)
);
}
//
}

0 comments on commit b67bd09

Please sign in to comment.