Ejemplo n.º 1
0
 /**
  * Change a capability
  *
  * @param  stdClass $marker
  * @param  string $name
  * @param  mixed $value
  * @return Capabilities Fluent interface
  * @throws Exception\InvalidArgumentException
  */
 protected function setCapability(stdClass $marker, $name, $value)
 {
     if ($this->marker !== $marker) {
         throw new Exception\InvalidArgumentException('Invalid marker');
     }
     $property = '_' . $name;
     if ($this->{$property} !== $value) {
         $this->{$property} = $value;
         // trigger event
         if ($this->storage instanceof EventsCapableInterface) {
             $this->storage->events()->trigger('capability', $this->storage, new ArrayObject(array($name => $value)));
         }
     }
     return $this;
 }