src/Plugin.php
protected function installPatchesForPackage(PackageInterface $package)
    {
        $considerPatchErrorsAsWarnings = $this->considerPatchErrorsAsWarnings();
        $patches = $this->getPatchCollection()->getPatchesFor($package);
        $patcher = $this->getPatcher();
        $appliedPatchesToSave = method_exists($package, 'setExtra') ? array() : null;
        foreach ($patches->getPatches() as $patch) {
            try {
                $patcher->applyPatch($patch, $package);
                if ($appliedPatchesToSave !== null) {
                    $appliedPatchesToSave[] = array(
                        'from-package' => $patch->getFromPackage()->getPrettyString(),
                        'path' => $patch->getOriginalPath(),
                        'description' => $patch->getDescription(),
                    );
                }
            } catch (GenericException $x) {
                $appliedPatchesToSave = null;
                if (!$considerPatchErrorsAsWarnings) {
                    throw $x;
                }
                $this->io->write('<error>'.$x->getMessage().'</error>');
            }
        }
        if ($appliedPatchesToSave !== null) {
            $this->setPatchedPackageData($package, array(
                'hash' => $patches->getHash(),
                'list' => $appliedPatchesToSave,
            ));
        }
    }
protected function installPatchesForPackage(PackageInterface $package)
    {
        $considerPatchErrorsAsWarnings = $this->considerPatchErrorsAsWarnings();
        $patches = $this->getPatchCollection()->getPatchesFor($package);
        $patcher = $this->getPatcher();
        $appliedPatchesToSave = method_exists($package, 'setExtra') ? array() : null;
        foreach ($patches->getPatches() as $patch) {
            try {
                $patcher->applyPatch($patch, $package);
                if ($appliedPatchesToSave !== null) {
                    $appliedPatchesToSave[] = array(
                        'from-package' => $patch->getFromPackage()->getPrettyString(),
                        'path' => $patch->getOriginalPath(),
                        'description' => $patch->getDescription(),
                    );
                }
            } catch (GenericException $x) {
                $appliedPatchesToSave = null;
                if (!$considerPatchErrorsAsWarnings) {
                    throw $x;
                }
                $this->io->write('<error>'.$x->getMessage().'</error>');
            }
        }
        if ($appliedPatchesToSave !== null) {
            $this->setPatchedPackageData($package, array(
                'hash' => $patches->getHash(),
                'list' => $appliedPatchesToSave,
            ));
        }
    }
protected function installPatchesForPackage ( PackageInterface $ package ) { $ considerPatchErrorsAsWarnings = $ this -> considerPatchErrorsAsWarnings ( ) ; $ patches = $ this -> getPatchCollection ( ) -> getPatchesFor ( $ package ) ; $ patcher = $ this -> getPatcher ( ) ; $ appliedPatchesToSave = method_exists ( $ package , 'setExtra' ) ? array ( ) : null ; foreach ( $ patches -> getPatches ( ) as $ patch ) { try { $ patcher -> applyPatch ( $ patch , $ package ) ; if ( $ appliedPatchesToSave !== null ) { $ appliedPatchesToSave [ ] = array ( 'from-package' => $ patch -> getFromPackage ( ) -> getPrettyString ( ) , 'path' => $ patch -> getOriginalPath ( ) , 'description' => $ patch -> getDescription ( ) , ) ; } } catch ( GenericException $ x ) { $ appliedPatchesToSave = null ; if ( ! $ considerPatchErrorsAsWarnings ) { throw $ x ; } $ this -> io -> write ( '<error>' . $ x -> getMessage ( ) . '</error>' ) ; } } if ( $ appliedPatchesToSave !== null ) { $ this -> setPatchedPackageData ( $ package , array ( 'hash' => $ patches -> getHash ( ) , 'list' => $ appliedPatchesToSave , ) ) ; } }
Install the patches for a specific package.

@param \Composer\Package\PackageInterface $package the package to be patched
Install the patches for a specific package .