Register a handler for custom directives.

@param  string  $name
@param  callable  $handler
@return void
487872
public function directive($name, callable $handler)
    {
        if (! preg_match('/^\w+(?:::\w+)?$/x', $name)) {
            throw new InvalidArgumentException("The directive name [{$name}] is not valid. Directive names must only contain alphanumeric characters and underscores.");
        }

        $this->customDirectives[$name] = $handler;
    }
769596
public function registerType($name, $handler, $aliases = array())
    {
        trigger_error("Types are deprecated, use JsonTypes through registerJsonType.", E_USER_DEPRECATED);
        $this->registerJsonType($name, new OldTypeWrapper($handler), $aliases);
    }
418706
def register(self, name: str):
        ''''''
        if name in self._callbacks:
            raise ValueError('Hook already registered')

        self._callbacks[name] = None

        if self._event_dispatcher is not None:
            self._event_dispatcher.register(name)
1124601
public function listen($event, callable $handler)
    {
        if (empty($this->handlers[$event])) {
            $this->handlers[$event] = [];
        }

        $this->handlers[$event][] = $handler;
    }
1339579
public function render(RenderHandler $handler)
    {
        if (!empty($this->version)) {
            $handler->add(self::DIRECTIVE_ROBOT_VERSION, $this->version);
        }
        return true;
    }
223857
public function addListener($name, callable $handler)
    {
        $this->assertEventName($name);
        $this->getEventDispatcher()->addListener($name, $handler);
        return $this;
    }
773381
public function setDefaultHandler($name)
    {
        if (!array_key_exists($name, $this->logRegistry)) {
            throw new \Exception('LogHandler named ['.$name.'] does not exist');
        }
        $this->defaultLogHandler = $name;
    }
621279
public function on(string $event, $handler)
    {
        if (self::isSupportedEvent($event)) {
            $this->options[$event] = $handler;
        }
    }
101889
public function addDirective($name, Aoe_ExtendedFilter_Model_Directive_Interface $handler)
    {
        $name = strtolower(trim($name));
        $this->directives[$name] = $handler;
        return $this;
    }
646040
public function setFormatOption($name, callable $handler)
    {
        if (in_array($name, static::$formatOptionsNames)) {
            return $this;
        }
        static::$formatOptionsNames[] = $name;
        static::$formatOptionsPlaceholders[] = '~' . count(static::$formatOptionsPlaceholders) . '~';
        static::$formatOptionsHandlers[] = $handler;
        return $this;
    }
222531
public function pipe($name, $handler = null)
    {
        if (is_callable($name)) {
            $handler = $name;
            $name    = null;
        }

        return $handler($this->getRepository($name), $this);
    }
374658
public function onRegister($name, Closure $callback)
    {
        $priority                  = $this->getPluginPriority($name);
        $this->registerCallbacks[] = compact('name', 'priority', 'callback');
    }
1165095
public function handler($handler)
    {
        if ($this->formDtoMappingCallback) {
            if (!($handler instanceof IParameterizedActionHandler)) {
                list($handler, $parameterDtoType) = $this->wrapArrayParameterAsDto($handler);
                $handler = new CustomParameterizedActionHandler($handler, $this->returnDtoType, $parameterDtoType);
            }

            /** @var IStagedFormDtoMapping $mapping */
            $mapping = call_user_func($this->formDtoMappingCallback, $handler->getParameterTypeClass());

            call_user_func($this->callback, new ParameterizedAction(
                $this->name,
                $this->authSystem,
                $this->requiredPermissions,
                $mapping,
                $handler,
                $this->metadata
            ));
        } else {

            if (!($handler instanceof IUnparameterizedActionHandler)) {
                $handler = new CustomUnparameterizedActionHandler($handler, $this->returnDtoType);
            }

            call_user_func($this->callback, new UnparameterizedAction(
                $this->name,
                $this->authSystem,
                $this->requiredPermissions,
                $handler,
                $this->metadata
            ));
        }
    }
811283
public function pushHandler($name, HandlerInterface $handler): LoggerInterface
    {
        $this->handlers->set($name, $handler);
        
        return $this;
    }
160865
public function on(string $event, callable $handler, $once = false): void
    {
        if (self::isSupportedEvent($event)) {
            self::$eventHandlers[$event][] = $handler;

            if (!isset(self::$events[$event])) {
                self::$events[$event] = (bool)$once;
            }
        }
    }
1214998
public function registerEvent(string $name, ?string $table = null, \Closure $action): void
    {
        $this->connection->getEventHandler()->registerEvent($name, $table, $action);
    }
106852
public function override(string $name, $handler): void
	{
		$this->clear($name);

		$this->register($name, $handler);
	}