src/RecipeCommandBehaviour.php
protected function modifyComposer($callable)
    {
        // Begin modification of composer.json
        $composerFile = new JsonFile(Factory::getComposerFile(), null, $this->getIO());
        $composerData = $composerFile->read();

        // Note: Respect call by ref $composerData
        $result = $callable($composerData);
        if ($result === false) {
            return;
        }
        if ($result) {
            $composerData = $result;
        }

        // Update composer.json and refresh local composer instance
        $composerFile->write($composerData);
        $this->resetComposer();
    }
protected function modifyComposer($callable)
    {
        // Begin modification of composer.json
        $composerFile = new JsonFile(Factory::getComposerFile(), null, $this->getIO());
        $composerData = $composerFile->read();

        // Note: Respect call by ref $composerData
        $result = $callable($composerData);
        if ($result === false) {
            return;
        }
        if ($result) {
            $composerData = $result;
        }

        // Update composer.json and refresh local composer instance
        $composerFile->write($composerData);
        $this->resetComposer();
    }
protected function modifyComposer ( $ callable ) { // Begin modification of composer.json $ composerFile = new JsonFile ( Factory :: getComposerFile ( ) , null , $ this -> getIO ( ) ) ; $ composerData = $ composerFile -> read ( ) ; // Note: Respect call by ref $composerData $ result = $ callable ( $ composerData ) ; if ( $ result === false ) { return ; } if ( $ result ) { $ composerData = $ result ; } // Update composer.json and refresh local composer instance $ composerFile -> write ( $ composerData ) ; $ this -> resetComposer ( ) ; }
callback to safely modify composer.json data

@param callable $callable Callable which will safely take and return the composer data.
This should return false if no content changed, or the updated data
callback to safely modify composer . json data