private function updateFileCleanly(JsonFile $jsonFile, array $new, $requireKey, $removeKey, $sortPackages, $isPostInstall)
    {
        $composerJson = $jsonFile->read();
        $manipulator = new JsonManipulator($composerJson);

        foreach ($new as $package => $constraint) {
            $constraint = $isPostInstall ? $this->findBestVersionForPackage($package, $constraint) : $constraint;
            if (!$manipulator->addLink($requireKey, $package, $constraint, $sortPackages)) {
                return false;
            }
            if (!$manipulator->removeSubNode($removeKey, $package)) {
                return false;
            }
        }
        $jsonFile->put($manipulator->getContents());

        return true;
    }
private function updateFileCleanly(JsonFile $jsonFile, array $new, $requireKey, $removeKey, $sortPackages, $isPostInstall)
    {
        $composerJson = $jsonFile->read();
        $manipulator = new JsonManipulator($composerJson);

        foreach ($new as $package => $constraint) {
            $constraint = $isPostInstall ? $this->findBestVersionForPackage($package, $constraint) : $constraint;
            if (!$manipulator->addLink($requireKey, $package, $constraint, $sortPackages)) {
                return false;
            }
            if (!$manipulator->removeSubNode($removeKey, $package)) {
                return false;
            }
        }
        $jsonFile->put($manipulator->getContents());

        return true;
    }
private function updateFileCleanly ( JsonFile $ jsonFile , array $ new , $ requireKey , $ removeKey , $ sortPackages , $ isPostInstall ) { $ composerJson = $ jsonFile -> read ( ) ; $ manipulator = new JsonManipulator ( $ composerJson ) ; foreach ( $ new as $ package => $ constraint ) { $ constraint = $ isPostInstall ? $ this -> findBestVersionForPackage ( $ package , $ constraint ) : $ constraint ; if ( ! $ manipulator -> addLink ( $ requireKey , $ package , $ constraint , $ sortPackages ) ) { return false ; } if ( ! $ manipulator -> removeSubNode ( $ removeKey , $ package ) ) { return false ; } } $ jsonFile -> put ( $ manipulator -> getContents ( ) ) ; return true ; }
Cleanly update a Composer JSON file.

@param JsonFile $jsonFile
@param array    $new
@param string   $requireKey
@param string   $removeKey
@param bool     $sortPackages
@param bool     $isPostInstall

@return bool
Cleanly update a Composer JSON file .