Register a custom ParseNode class for a given symbol
@param Mixed
@param string
@return void
196818
function register_node_class( $s, $class ){
		if( ! class_exists($class) ){
			$s = $this->token_name( $s );
			throw new Exception( "If you want to register class `$class' for symbol `$s' you should include it first" );
		}
		$this->node_classes[$s] = $class;
	}
72109
public function parse($text) {
        $parsedText = $this->parseGs1128($text);
        if($this->customLabelText!==false and CINBarcode1D::AUTO_LABEL!=$this->customLabelText){
            parent::setLabel($this->customLabelText);    
        }
        parent::parse($parsedText);
    }
1052379
def _register_parser(cls):
    ''''''
    assert cls.cls_msg_type is not None
    assert cls.cls_msg_type not in _MSG_PARSERS
    _MSG_PARSERS[cls.cls_msg_type] = cls.parser
    return cls
1105762
public function name(string $name, $parser): void
    {
        if (\is_string($parser) && (\class_exists($parser, false) || $this->app->bound($parser))) {
            $parser = $this->app->make($parser);
        }

        $this->parsers[$name] = $parser;
    }
65547
private static function register_widget( $widget_class ) {
		register_widget( $widget_class );

		$callback = [ $widget_class, 'post_registration' ];
		if ( is_callable( $callback, true ) ) {
			call_user_func( $callback );
		}
	}
1198671
public function registerInstance($object)
    {
        if (!is_object($object)) {
            throw new \InvalidArgumentException('registerInstance(): Cannot pass primitive types, can only register an object instance; use registerVariable() instead');
        }

        $reflectionObject = new \ReflectionObject($object);
        $className = $reflectionObject->getName();

        // Register strong link in $instance
        $this->instances[$className] = $object;

        // Recursively determine and register weak links
        $determineParent = function (\ReflectionClass $class) use ($className, &$determineParent) {
            $parentClass = $class->getParentClass();

            if (!empty($parentClass)) {
                $this->weakLinks[$parentClass->getName()] = $className;
                $determineParent($parentClass);
            }
        };

        $determineParent($reflectionObject);
    }
71079
static void parse(String inString, IContext context, INode parent) {
        List<String> tokens = getCommaTokens(inString);
        for (String token : tokens) {
            int isFunction = token.indexOf(OPEN_PARENTHESIS);
            if (isFunction >= 0) {
                String funcName = token.substring(0, isFunction);
                INode newParent = addChild(parent, context, funcName);
                String arguments = token.substring(isFunction + 1, token.length() - 1);
                parse(arguments, context, newParent);
            } else {
                addChild(parent, context, token);
            }
        }
    }
929867
function registerType($typeIdentifier, \Plasma\Types\TypeExtensionInterface $type): void {
        if(isset($this->regularTypes[$typeIdentifier]) || isset($this->classTypes[$typeIdentifier])) {
            throw new \Plasma\Exception('Type identifier is already in use');
        }
        
        if(\in_array($typeIdentifier, static::PHP_TYPES, true)) {
            $this->regularTypes[$typeIdentifier] = $type;
        } else {
            $this->classTypes[$typeIdentifier] = $type;
        }
    }
894263
function modify( $tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$value, $namedParameters, $placement )
    {
        if ( isset( $this->PHPNameMap[$operatorName] ) )
        {
            $typeFunction = $this->PHPNameMap[$operatorName];
            $this->checkType( $typeFunction, $tpl, $value, $operatorParameters, $rootNamespace, $currentNamespace, $placement );
            return;
        }
        switch ( $operatorName )
        {
            case $this->IsClassName:
            {
                if ( count( $operatorParameters ) == 1 )
                {
                    $className = $tpl->elementValue( $operatorParameters[0], $rootNamespace, $currentNamespace, $placement );
                    $value = strtolower( get_class( $value ) ) == strtolower( $className );
                }
                else
                {
                    $className = $tpl->elementValue( $operatorParameters[0], $rootNamespace, $currentNamespace, $placement );
                    $value = strtolower( get_class( $tpl->elementValue( $operatorParameters[1], $rootNamespace, $currentNamespace, $placement ) ) ) == strtolower( $className );
                }
            } break;
            case $this->IsSetName:
            {
                if ( count( $operatorParameters ) > 0 )
                {
                    if ( count( $operatorParameters ) > 1 )
                    {
                        $tpl->extraParameters( $operatorName, count( $operatorParameters ), 1 );
                    }

                    $operand = $tpl->elementValue( $operatorParameters[0], $rootNamespace, $currentNamespace, $placement, true );
                    $value = $operand !== null;


                }
                else
                    $tpl->missingParameter( $operatorName, 'input' );

            } break;
            case $this->IsUnsetName:
            {
                if ( count( $operatorParameters ) > 0 )
                {
                    if ( count( $operatorParameters ) > 1 )
                        $tpl->extraParameters( $operatorName,
                                               count( $operatorParameters ),
                                               1 );
                    $operand = $tpl->elementValue( $operatorParameters[0], $rootNamespace, $currentNamespace, $placement, true );
                    $value = $operand === null;
                }
                else
                    $tpl->missingParameter( $operatorName, 'input' );
            } break;
            case $this->GetTypeName:
            {
                if ( count( $operatorParameters ) > 0 )
                {
                    if ( count( $operatorParameters ) > 1 )
                        $tpl->extraParameters( $operatorName,
                                               count( $operatorParameters ),
                                               1 );
                    $operand = $tpl->elementValue( $operatorParameters[0], $rootNamespace, $currentNamespace, $placement );
                }
                else
                    $operand =& $value;
                if ( $operand === null )
                    $value = 'null';
                else if ( is_bool( $operand ) )
                    $value = 'boolean[' . ( $operand ? 'true' : 'false' ) . ']';
                else if ( is_object( $operand ) )
                    $value = 'object[' . get_class( $operand ) . ']';
                else if ( is_array( $operand ) )
                    $value = 'array[' . count( $operand ) . ']';
                else if ( is_string( $operand ) )
                    $value = 'string[' . strlen( $operand ) . ']';
                else
                    $value = gettype( $operand );
            } break;
            case $this->GetClassName:
            {
                if ( count( $operatorParameters ) > 0 )
                {
                    if ( count( $operatorParameters ) > 1 )
                        $tpl->extraParameters( $operatorName,
                                               count( $operatorParameters ),
                                               1 );
                    $operand = $tpl->elementValue( $operatorParameters[0], $rootNamespace, $currentNamespace, $placement );
                    $value = strtolower( get_class( $operand ) );
                }
                else
                {
                    $value = strtolower( get_class( $value ) );
                }
            } break;
        }
    }
480987
static function register(iWrapperStream $wrapper, $label = null)
    {
        if ($label == null)
            $label = $wrapper->getLabel();

        if ($pos = strpos($label, ':') !== false)
            throw new \Exception(sprintf(
                '(%s) Is Invalid Label Provided For Stream Wrapper.'
                . ' It must include just a name like "http".'
                , $label
            ));

        stream_wrapper_register($label, get_class($wrapper));

        // Set the default stream context which will be used whenever
        // file operations (fopen(), file_get_contents(), etc...) are
        // called without a context parameter.
        $options = array(
            $label => \Poirot\Std\cast($wrapper->optsData())->toArray()
        );

        stream_context_set_default($options);
    }
1256186
public function registerClientScript()
    {
        $view = $this->getView();
        $selector = '#' . $this->id;
        $view->registerJs(new JsExpression(<<< JS
            $.fn.passwordInput = function(options) {
                
                var settings = $.extend({}, options);
                
                var _this = this;
                
                var randomString = function (length, specialChars) {
                    var specialChars = specialChars !== undefined ? specialChars : true;
                    var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz';
                    chars = specialChars ? chars + '!@#$%^&*()_=./<>' : chars;
                    chars = chars.split('');
                    if (!length) length = Math.floor(Math.random() * chars.length);
                    var str = '';
                    for (var i = 0; i < length; i++) str += chars[Math.floor(Math.random() * chars.length)];
                    return str;
                }
                
                _this.find('.random-passgen').each(function() {
                    $(this).click(function(event) { 
                        event.preventDefault();
                        var value = randomString($(this).data('length'), $(this).data('specialchars')!=0);
                        _this.find('.show-password').trigger('click', [value]);
                    });
                });
                
                _this.find('.show-password').each(function() {
                    $(this).click(function(event, value) {
                        var input = _this.find('input');
                        if ($(this).hasClass('disabled')) {
                            return true;
                        }

                        var type = input.attr('type');

                        if (value) input.val(value).select();

                        if (type == 'password' || value) {
                            input.attr('type', 'text');
                            $(this).find('span').removeClass('glyphicon-eye-open').addClass('glyphicon-eye-close');
                        } else {
                            input.attr('type', 'password');
                            $(this).find('span').removeClass('glyphicon-eye-close').addClass('glyphicon-eye-open');
                        }
                    });
                });
                    
                  
            };

            $('{$selector}').passwordInput();
JS
        ), \yii\web\View::POS_READY);

        return true;
    }
93151
protected void registerKnownJdkImmutableClasses() {
        registerImmutable(String.class);
        registerImmutable(Integer.class);
        registerImmutable(Long.class);
        registerImmutable(Boolean.class);
        registerImmutable(Class.class);
        registerImmutable(Float.class);
        registerImmutable(Double.class);
        registerImmutable(Character.class);
        registerImmutable(Byte.class);
        registerImmutable(Short.class);
        registerImmutable(Void.class);

        registerImmutable(BigDecimal.class);
        registerImmutable(BigInteger.class);
        registerImmutable(URI.class);
        registerImmutable(URL.class);
        registerImmutable(UUID.class);
        registerImmutable(Pattern.class);
    }
1106571
public static function register(
        string $metadataDir,
        string $metadataNamespace,
        ?callable $notFoundCallback = null
    ) : Closure {
        $metadataNamespace = ltrim($metadataNamespace, '\\');

        if (! ($notFoundCallback === null || is_callable($notFoundCallback))) {
            $type = is_object($notFoundCallback) ? get_class($notFoundCallback) : gettype($notFoundCallback);

            throw new InvalidArgumentException(
                sprintf('Invalid \$notFoundCallback given: must be a callable, "%s" given', $type)
            );
        }

        $autoloader = static function ($className) use ($metadataDir, $metadataNamespace, $notFoundCallback) {
            if (strpos($className, $metadataNamespace) === 0) {
                $file = Autoloader::resolveFile($metadataDir, $metadataNamespace, $className);

                if ($notFoundCallback && ! file_exists($file)) {
                    call_user_func($notFoundCallback, $metadataDir, $metadataNamespace, $className);
                }

                require $file;
            }
        };

        spl_autoload_register($autoloader);

        return $autoloader;
    }
273726
public static function register($prepend = false)
    {
        if (self::$registered) {
            return;
        }

        spl_autoload_register(array(__CLASS__, 'loadClass'), true, $prepend);
        self::$registered = true;
    }
175345
private function parseComposerLoader(): void
    {
        // get composer autoload map
        $map = $this->loader->getPrefixes();
        if (Any::isArray($map)) {
            // get all available apps root dirs by psr loader for apps
            if (array_key_exists('Apps\\', $map)) {
                foreach ($map['Apps\\'] as $appPath) {
                    $this->appRoots[] = $appPath;
                }
            }

            // get Widgets map
            if (array_key_exists('Widgets\\', $map)) {
                // get all available root dirs by psr loader for widgets
                foreach ($map['Widgets\\'] as $widgetPath) {
                    $this->widgetRoots[] = $widgetPath;
                }
            }
        }

        // set default root path if not found anything else
        if (count($this->appRoots) < 1) {
            $this->appRoots = [root];
        }

        if (count($this->widgetRoots) < 1) {
            $this->widgetRoots = [root];
        }
    }
1174255
private function compile()
    {
        // replace pseudo {param}:type syntax to valid regex
        if (strpos($this->regex, '}:') !== false) {
            $this->regex = preg_replace('#\{([a-zA-Z0-9_-]+)\}:([a-z]+)#', '(?P<$1>:$2)', $this->expression);
            $this->regex = str_replace(
                array_keys($this->regexExpression),
                array_values($this->regexExpression),
                $this->regex
            );
        }

        // replace pseudo {param} syntax without type to valid regex
        if (strpos($this->regex, '}') !== false) {
            $this->regex = preg_replace('#\{([a-zA-Z_]+)\}#', '(?P<$1>[^\/]+)', $this->regex);
        }

        // allow optional trailing slash at the end
        if (substr($this->regex, -1) !== '/') {
            $this->regex .= '[\/]?';
        }
    }
858478
protected function parse(): void
    {
        // add the root node
        $this->root = new HtmlNode('root');
        $activeNode = $this->root;
        while ( ! is_null($activeNode)) {
            $str = $this->content->copyUntil('<');
            if ($str == '') {
                $info = $this->parseTag();
                if ( ! $info['status']) {
                    // we are done here
                    $activeNode = null;
                    continue;
                }

                // check if it was a closing tag
                if ($info['closing']) {
                    $foundOpeningTag  = true;
                    $originalNode     = $activeNode;
                    while ($activeNode->getTag()->name() != $info['tag']) {
                        $activeNode = $activeNode->getParent();
                        if (is_null($activeNode)) {
                            // we could not find opening tag
                            $activeNode = $originalNode;
                            $foundOpeningTag = false;
                            break;
                        }
                    }
                    if ($foundOpeningTag) {
                        $activeNode = $activeNode->getParent();
                    }
                    continue;
                }

                if ( ! isset($info['node'])) {
                    continue;
                }

                /** @var AbstractNode $node */
                $node = $info['node'];
                $activeNode->addChild($node);

                // check if node is self closing
                if ( ! $node->getTag()->isSelfClosing()) {
                    $activeNode = $node;
                }
            } else if ($this->options->whitespaceTextNode ||
                trim($str) != ''
            ) {
                // we found text we care about
                $textNode = new TextNode($str, $this->options->removeDoubleSpace);
                $activeNode->addChild($textNode);
            }
        }
    }