Create a hook.
@param string   $identifier
@param callable $cb
@param string   $type   on|pre|post
351284
protected function createhook($identifier, $cb, $type='on') {
		$identifier .= '.'.$type;

		$this->set($identifier, $cb);
	}
385488
public function add_resource(cc_i_resource $res, $identifier = null, $type = 'webcontent') {

        if (!$this->ccobj->valid($type)) {
            throw new Exception("Type invalid...");
        }

        if ($res == null) {
            throw new Exception('Invalid Resource or dont give it');
        }
        $rst = $res;

        // TODO: This has to be reviewed since it does not handle multiple files properly.
        // Dependencies.
        if (is_object($identifier)) {
            $this->activemanifest->create_resource_node($rst, $this->doc, $identifier);
        } else {
            $nresnode   = null;

            $rst->type = $type;
            if (!cc_helpers::is_html($rst->filename)) {
                $rst->href = null;
            }

            $this->activemanifest->create_resource_node($rst, $this->doc, $nresnode);
            foreach ($rst->files as $file) {
                $ident = $this->get_identifier_by_filename($file);
                if ($ident == null) {
                    $newres = new cc_resource($rst->manifestroot, $file);
                    if (!cc_helpers::is_html($file)) {
                         $newres->href = null;
                    }
                    $newres->type = 'webcontent';
                    $this->activemanifest->create_resource_node($newres, $this->doc, $nresnode);
                }
            }
        }

        $tmparray = array($rst->identifier, $rst->files[0]);
        return $tmparray;
    }
258578
public function registerSubscriber($identifier, array $config = array())
    {
        $result = false;

        //Create the complete identifier if a partial identifier was passed
        if (is_string($identifier) && strpos($identifier, '.') === false)
        {
            $identifier = $this->getIdentifier()->toArray();
            $identifier['path'] = array('event', 'subscriber');
            $identifier['name'] = $identifier;
        }

        $identifier = $this->getIdentifier($identifier);
        $class      = $this->getObject('manager')->getClass($identifier);

        if(!$class || !array_key_exists('Kodekit\Library\EventSubscriberInterface', class_implements($class)))
        {
            throw new \UnexpectedValueException(
                'Event Subscriber: '.$identifier.' does not implement Kodekit\Library\EventSubscriberInterface'
            );
        }

        if (!isset($this->__subscribers[(string)$identifier]))
        {
            $listeners = call_user_func(array($class, 'getEventListeners'));/*$class::getEventListeners();*/

            if (!empty($listeners))
            {
                $identifier->getConfig()->merge($config);

                foreach($listeners as $listener) {
                    $this->__listeners[$listener][] = $identifier;
                }
            }

            $this->__subscribers[(string)$identifier] = true;
        }

        return $result;
    }
445580
public function unregister($identifier, $type = "")
    {
        if (!$this->isRegistered($identifier, $type)) {
            throw new RegistryException(
                RegistryException::UNKNOWN_IDENTIFIER_TEXT . '(identifier: ' . $identifier . ')',
                RegistryException::UNKNOWN_IDENTIFIER_CODE
            );
        }

        $this->getESAdaptor()->removeDocuments(array($identifier), $this->section, $type);
    }
1172273
public function register($identifier, $value, $type = "")
    {
        if ($this->isRegistered($identifier, $type)) {
            throw new RegistryException(
                RegistryException::DUPLICATE_REGISTRATION_ATTEMPT_TEXT . '(identifier: ' . $identifier . ')',
                RegistryException::DUPLICATE_REGISTRATION_ATTEMPT_CODE
            );
        }

        $this->getESAdaptor()->registerDocument($this->section, $value, $identifier, $type);
    }
1231498
function (type, handler) {
        var handlers = this.handlers();
        if (handlers[type]) {
            throw new Error('The hook has already been registered, you can use only one hook for specific event type: ' + type + ', point.id:' + this._id);
        }
        handlers[type] = handler;
        this._handlersConfigured = true;
        return this;
    }
795207
public function buildForm($identifier = null)
	{
		$this->setFormMapper(new FormMapper);
		$this->configureForm($this->getFormMapper());

		$this->setFormBuilder(new FormBuilder($this->getFormMapper()));
		$this->getFormBuilder()
			->setModel($this->getModel())
			->setIdentifier($identifier)
			->setContext($identifier === null ? FormBuilder::CONTEXT_CREATE : FormBuilder::CONTEXT_EDIT)
			->build();

		return $this;
	}
44400
public static function extend($type, $callback=null)
    {
        if (is_array($type)) {
            self::$type=array_merge(self::$type, $type);
        } else {
            self::$type[$type]=$callback;
        }
    }
862373
function runHook (instance, type) {
  var hook = type ? 'response' : 'request'
  hook += 'Hook'
  if (instance[hook] && isFunction(instance[hook])) {
    instance[hook]()
  }
}
1326898
private function triggerActionEvent($instance, $action, $type = 'before')
    {
        if (method_exists($instance, $type . ucfirst($action))) {
            call_user_func([$instance, $type . ucfirst($action)]);
        }
    }
910695
public function request($addr, $type, $data, $cb)
    {
        $e = explode(':', $addr);
        $this->getConnection('valve://[udp:' . $e[0] . ']' . (isset($e[1]) ? ':' . $e[1] : '') . '/',
            function ($conn) use ($cb, $addr, $data, $type) {
                if (!$conn->connected) {
                    $cb($conn, false);
                    return;
                }
                $conn->request($type, $data, $cb);
            });
    }
479295
public static function setCallback( $identifier, $callbackClassname )
    {
        if ( array_key_exists( $identifier, self::$callbackMap ) )
        {
            throw new ezcBaseInitCallbackConfiguredException( $identifier, self::$callbackMap[$identifier] );
        }
        else
        {
            // Check if the passed classname actually exists
            if ( !ezcBaseFeatures::classExists( $callbackClassname, true ) )
            {
                throw new ezcBaseInitInvalidCallbackClassException( $callbackClassname );
            }

            // Check if the passed classname actually implements the interface.
            if ( !in_array( 'ezcBaseConfigurationInitializer', class_implements( $callbackClassname ) ) )
            {
                throw new ezcBaseInitInvalidCallbackClassException( $callbackClassname );
            }

            self::$callbackMap[$identifier] = $callbackClassname;
        }
    }
48966
public function addIdentifier($identifier)
    {
        if (!isset($this->identifiers[$identifier])) {
            $this->identifiers[$identifier] = $identifier;
        }

        return $this;
    }
378436
public function instantiate($identifier, $config = array())
    {
        //Get the filter(s) we need to create
        $filters = (array) $identifier;

        //Create the filter chain
        $filter = array_shift($filters);
        $filter = $this->_createFilter($filter, $config);

        foreach ($filters as $name) {
            $filter->addFilter(self::_createFilter($name, $config));
        }

        return $filter;
    }
355362
function(type, callback) {
        var list = this.__hooks[type] || [];
            list.push(callback);

        this.__hooks[type] = list;
    }
490091
public function setIdentifier($identifier) {
		parent::setIdentifier($identifier);
		if($this->content instanceof HtmlLink){
			$this->content->setIdentifier("link-".$identifier);
		}
	}
950326
protected function _enqueue(string $identifier, string $type): QueueItemInterface
    {
        $queueItem = QueueItem::create($identifier, $type);

        $this->queueItemRepository->save($queueItem);

        return $queueItem;
    }