public function setKeyword($keyword, $action)
    {
        if (!is_callable($action)) {
            throw new InvalidArgumentException("Please add a callable action for your keyword $keyword", 30);
        }

        if (!$this->hasValidCustomKeywordsOption()) {
            $this->setOption('keywords', []);
        }

        if ($action instanceof ExtensionContainerInterface) {
            $this->addExtension($action->getExtension());
        }

        $this->setOption(['keywords', $keyword], $action);
    }
public function setKeyword($keyword, $action)
    {
        if (!is_callable($action)) {
            throw new InvalidArgumentException("Please add a callable action for your keyword $keyword", 30);
        }

        if (!$this->hasValidCustomKeywordsOption()) {
            $this->setOption('keywords', []);
        }

        if ($action instanceof ExtensionContainerInterface) {
            $this->addExtension($action->getExtension());
        }

        $this->setOption(['keywords', $keyword], $action);
    }
public function setKeyword ( $ keyword , $ action ) { if ( ! is_callable ( $ action ) ) { throw new InvalidArgumentException ( "Please add a callable action for your keyword $keyword" , 30 ) ; } if ( ! $ this -> hasValidCustomKeywordsOption ( ) ) { $ this -> setOption ( 'keywords' , [ ] ) ; } if ( $ action instanceof ExtensionContainerInterface ) { $ this -> addExtension ( $ action -> getExtension ( ) ) ; } $ this -> setOption ( [ 'keywords' , $ keyword ] , $ action ) ; }
Set custom keyword.

@param string   $keyword the keyword to be found.
@param callable $action  action to be executed when the keyword is found.
Set custom keyword .