ReplaceTokens::_initialize PHP Method

_initialize() private method

This method is only called when this filter is used through a tag in build file.
private _initialize ( )
    private function _initialize()
    {
        $params = $this->getParameters();
        if ($params !== null) {
            for ($i = 0; $i < count($params); $i++) {
                if ($params[$i] !== null) {
                    $type = $params[$i]->getType();
                    if ($type === "tokenchar") {
                        $name = $params[$i]->getName();
                        if ($name === "begintoken") {
                            $this->_beginToken = substr($params[$i]->getValue(), 0, 1);
                        } else {
                            if ($name === "endtoken") {
                                $this->_endToken = substr($params[$i]->getValue(), 0, 1);
                            }
                        }
                    } else {
                        if ($type === "token") {
                            $name = $params[$i]->getName();
                            $value = $params[$i]->getValue();
                            $tok = new Token();
                            $tok->setKey($name);
                            $tok->setValue($value);
                            array_push($this->_tokens, $tok);
                        } else {
                            if ($type === "tokensource") {
                                // Store data from nested tags in local array
                                $arr = array();
                                $subparams = $params[$i]->getParams();
                                $count = count($subparams);
                                for ($i = 0; $i < $count; $i++) {
                                    $arr[$subparams[$i]->getName()] = $subparams[$i]->getValue();
                                }
                                // Create TokenSource
                                $tokensource = new TokenSource();
                                if (isset($arr["classname"])) {
                                    $tokensource->setClassname($arr["classname"]);
                                }
                                // Copy other parameters 1:1 to freshly created TokenSource
                                foreach ($arr as $key => $value) {
                                    if (strtolower($key) === "classname") {
                                        continue;
                                    }
                                    $param = $tokensource->createParam();
                                    $param->setName($key);
                                    $param->setValue($value);
                                }
                                $this->_tokensources[] = $tokensource;
                            }
                        }
                    }
                }
            }
        }
    }