src/PatchExecutor.php
public function applyPatch(Patch $patch, $baseDirectory)
    {
        $error = null;
        foreach ($patch->getLevels() as $patchLevel) {
            try {
                $this->applyPatchLevel($patch, $baseDirectory, $patchLevel);

                return;
            } catch (Exception\PatchAlreadyApplied $x) {
                throw $x;
            } catch (Exception\PatchNotApplied $x) {
                if ($error === null) {
                    $error = $x;
                }
            }
        }
        throw $error;
    }
public function applyPatch(Patch $patch, $baseDirectory)
    {
        $error = null;
        foreach ($patch->getLevels() as $patchLevel) {
            try {
                $this->applyPatchLevel($patch, $baseDirectory, $patchLevel);

                return;
            } catch (Exception\PatchAlreadyApplied $x) {
                throw $x;
            } catch (Exception\PatchNotApplied $x) {
                if ($error === null) {
                    $error = $x;
                }
            }
        }
        throw $error;
    }
public function applyPatch ( Patch $ patch , $ baseDirectory ) { $ error = null ; foreach ( $ patch -> getLevels ( ) as $ patchLevel ) { try { $ this -> applyPatchLevel ( $ patch , $ baseDirectory , $ patchLevel ) ; return ; } catch ( Exception \ PatchAlreadyApplied $ x ) { throw $ x ; } catch ( Exception \ PatchNotApplied $ x ) { if ( $ error === null ) { $ error = $ x ; } } } throw $ error ; }
Apply a patch to a base directory.

@param \ComposerPatcher\Patch $patch the patch to be applied
@param string $baseDirectory the directory where the patch should be applied

@throws \ComposerPatcher\Exception\PatchAlreadyApplied if the patch is already applied
@throws \ComposerPatcher\Exception\PatchNotApplied if the patch could not be applied

@return bool
Apply a patch to a base directory .