diff --git a/src/Patch.php b/src/Patch.php index b2026939..4f201d68 100644 --- a/src/Patch.php +++ b/src/Patch.php @@ -2,6 +2,8 @@ namespace cweagans\Composer; +use Composer\Package\PackageInterface; + class Patch implements \JsonSerializable { /** @@ -78,4 +80,17 @@ public function jsonSerialize() 'depth' => $this->depth, ]; } + + /** + * Indicates if a package has been patched. + * + * @param \Composer\Package\PackageInterface $package + * The package to check. + * + * @return bool + * TRUE if the package has been patched. + */ + public static function isPackagePatched(PackageInterface $package) { + return array_key_exists('patches_applied', $package->getExtra()); + } }