Wikimedia\Composer\Merge\PluginState::setLocked PHP Method

setLocked() public method

Set the locked flag
public setLocked ( boolean $flag )
$flag boolean
    public function setLocked($flag)
    {
        $this->locked = (bool) $flag;
    }

Usage Example

示例#1
0
 /**
  * Handle an event callback following installation of a new package by
  * checking to see if the package that was installed was our plugin.
  *
  * @param PackageEvent $event
  */
 public function onPostPackageInstall(PackageEvent $event)
 {
     $op = $event->getOperation();
     if ($op instanceof InstallOperation) {
         $package = $op->getPackage()->getName();
         if ($package === self::PACKAGE_NAME) {
             $this->logger->info('composer-merge-plugin installed');
             $this->state->setFirstInstall(true);
             $this->state->setLocked($event->getComposer()->getLocker()->isLocked());
         }
     }
 }