_disabled = array_diff($this->_disabled, (array)$name); } /** * Disables callbacks on a object or array of objects. Public object methods are still * callable as normal. * * @param mixed $name CamelCased name of the objects(s) to disable (string or array) * @return void */ public function disable($name) { foreach ((array)$name as $object) { if (in_array($object, $this->_attached) && !in_array($object, $this->_disabled)) { $this->_disabled[] = $object; } } } /** * Gets the list of currently-enabled objects, or, the current status of a single objects * * @param string $name Optional. The name of the object to check the status of. If omitted, * returns an array of currently-enabled object * @return mixed If $name is specified, returns the boolean status of the corresponding object. * Otherwise, returns an array of all enabled objects. */ public function enabled($name = null) { if (!empty($name)) { return (in_array($name, $this->_attached) && !in_array($name, $this->_disabled)); } return array_diff($this->_attached, $this->_disabled); } /** * Gets the list of attached behaviors, or, whether the given behavior is attached * * @param string $name Optional. The name of the behavior to check the status of. If omitted, * returns an array of currently-attached behaviors * @return mixed If $name is specified, returns the boolean status of the corresponding behavior. * Otherwise, returns an array of all attached behaviors. */ public function attached($name = null) { if (!empty($name)) { return (in_array($name, $this->_attached)); } return $this->_attached; } }