/** * 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->adapter instanceof EventsCapableInterface) { $this->adapter->events()->trigger('capability', $this->adapter, new ArrayObject(array($name => $value))); } } return $this; }