{@inheritDoc}

@SuppressWarnings(PHPMD.Superglobals)
@SuppressWarnings(PHPMD.CamelCaseVariableName)
324411
protected function getValue($string, $domain, $locale)
    {
        if (!$domain) {
            $domain = 'default';
        }

        $this->loadDomain($domain, $locale);

        // We have to treat 'languages', 'default', 'modules' etc. domains differently.
        if (!(isset($GLOBALS['TL_LANG'][$domain]) && is_array($GLOBALS['TL_LANG'][$domain]))
            && (substr($domain, 0, 2) != 'tl_')
        ) {
            $lang = $GLOBALS['TL_LANG'];
        } else {
            if (!is_array($GLOBALS['TL_LANG'][$domain])) {
                return $string;
            }
            $lang = $GLOBALS['TL_LANG'][$domain];
        }

        $chunks = explode('.', $string);

        while (($chunk = array_shift($chunks)) !== null) {
            if (!array_key_exists($chunk, $lang)) {
                return $string;
            }

            $lang = $lang[$chunk];
        }

        return $lang;
    }
144782
function hasVariable( $blockName, $varName )
    {
        // 1. Check if the variable is set in either injected or regular settings.
        if (
            !isset( self::$injectedSettings[$this->FileName][$blockName][$varName] )
            && !isset( $this->BlockValues[$blockName][$varName] )
        )
        {
            return false;
        }

        // 2. Check if injected setting isn't strictly false (false being the default value when a variable doesn't exist).
        if (
            isset( self::$injectedSettings[$this->FileName][$blockName][$varName] )
            && self::$injectedSettings[$this->FileName][$blockName][$varName] === false
        )
        {
            return false;
        }

        return true;
    }
525630
private function buildVariableDefinitions() {
        foreach($this->getFields() as $field) {
            $variable = new Object\Variable();
            $variable->setName($field->getShortName());
            $variable->setAccess('protected');
            $variable->setAutoIncrementing($field->isAutoIncrementing());
            $variable->setDescription($field->getDescription());
            $variable->setLength($field->getLength());
            $variable->setNullable($field->isNullable());
            $variable->setPrimary($field->isPrimary());
            $variable->setType($field->getType());
            $this->getAbstractClass()->addVariable($variable);
        }
    }
436438
public function setGlobalVariable($variable = NULL, $value = NULL)
	{
		try {

			$result = FALSE;

			if (is_null($variable))
				throw new Exception("Global variable name not provided or is null", 503);

			if (is_null($value))
				throw new Exception("Global variable value not provided or is null", 503);

			$uri = "/asterisk/variable";
			$postData = array("variable" => $variable, "value" => $value);

			$this->ariEndpointOptions['json'] = $postData;
			$result = json_decode($this->ariEndpointClient->post($this->ariEndpointURL . $uri, $this->ariEndpointOptions)->getBody()->getContents());

			return $result;

		} catch (\GuzzleHttp\Exception\RequestException $e) {
			$this->phpariObject->lasterror = $e->getMessage();
			$this->phpariObject->lasttrace = $e->getTraceAsString();
			return (int)$e->getCode();
		} catch (\GuzzleHttp\Exception\ClientException $e) {
			$this->phpariObject->lasterror = $e->getMessage();
			$this->phpariObject->lasttrace = $e->getTraceAsString();
			return (int)$e->getCode();
		} catch (\GuzzleHttp\Exception\ServerException $e) {
			$this->phpariObject->lasterror = $e->getMessage();
			$this->phpariObject->lasttrace = $e->getTraceAsString();
			return (int)$e->getCode();
		} catch (Exception $e) {
			$this->phpariObject->lasterror = $e->getMessage();
			$this->phpariObject->lasttrace = $e->getTraceAsString();

			return FALSE;
		}
	}
653940
public function setVariable($key, $value)
    {
        $key = (string) $key;
        $this->currentRequest->variables->$key = $value;
        return true;
    }
494606
function (loop, variables) {
    var variable = false;
    try {
        variable = varsParser.evaluate('(' + loop.variable + ')', variables);
    } catch (err) {
        throw new Error('Error executing loop expression: ' + loop.variable + ' <' + err.message + '>');
    }

    var html = '';
    var loopVariables = _.clone(variables, true);

    (function (iterate) {
        if (Array.isArray(variable)) {
            for (var i = 0, l = variable.length; i < l; i++) {
                iterate(i, variable[i]);
            }
        } else {
            for (var i in variable) {
                if (!variable.hasOwnProperty(i)) {
                    continue;
                }
                iterate(i, variable[i]);
            }
        }
    })(function (key, value) {
        loopVariables.$key = loopVariables[loop.keyName] = key;
        loopVariables.$value = loopVariables[loop.valueName] = value;

        var loopHtml = loop.content;

         //<if/> (condicionais, execução das condicionais para geração do template)
        loopHtml = conditionalParser(loopHtml, loopVariables);

        loop.children.forEach(function (child) {
            loopHtml = loopHtml.replace(child.mark, proccessLoop(child, loopVariables));
        });

        // #{vars} (escapando as variaveis no template)
        loopHtml = varsParser.escapeValues(loopHtml, loopVariables);

        html += loopHtml;
    });

    return html;
}
845263
function hasLocalVariable( $varName, $rootNamespace )
    {
        return ( array_key_exists( $rootNamespace, $this->CurrentLocalVariablesNames ) &&
                 array_key_exists( $varName, $this->CurrentLocalVariablesNames[$rootNamespace] ) );
    }
208114
public function resetTemplateVariables()
    {
        $data = &$this->getDataPlaceHolder();
        
        foreach (array_keys($data) as $k) {
            if ($data[$k] instanceof TemplateVariable) {
                $data[$k]->applyDefaultValue();
            }
        }
    }
1251074
function setVariable( $blockName, $variableName, $variableValue )
    {
        if ( !$this->isSettingReadOnly( $this->filename(), $blockName, $variableName ) )
            return false;

        $this->BlockValues[$blockName][$variableName] = $variableValue;
        $this->ModifiedBlockValues[$blockName][$variableName] = true;
    }
650552
public static function processMagicVariables() {
		$variables_object = new \Object\Magic\Variables();
		$variables = $variables_object->get();
		$input = \Request::input(null, true, true);
		foreach ($variables as $k => $v) {
			if (!array_key_exists($k, $input)) {
				self::$settings['flag']['global'][$k] = null;
				continue;
			}
			if ($k == '__content_type') {
				$object = new \Object\Content\Types();
				$data = $object->get();
				if (isset($data[$input[$k]])) {
					self::$settings['flag']['global'][$k] = $input[$k];
				}
			} else {
				self::$settings['flag']['global'][$k] = $input[$k];
			}
		}
	}
451389
protected function setBasicVariablesNoneAdminView($view)
    {
        $view->clientSideConfig = PiwikConfig::getInstance()->getClientSideOptions();
        $view->isSuperUser = Access::getInstance()->hasSuperUserAccess();
        $view->hasSomeAdminAccess = Piwik::isUserHasSomeAdminAccess();
        $view->hasSomeViewAccess  = Piwik::isUserHasSomeViewAccess();
        $view->isUserIsAnonymous  = Piwik::isUserIsAnonymous();
        $view->hasSuperUserAccess = Piwik::hasUserSuperUserAccess();

        if (!Piwik::isUserIsAnonymous()) {
            $view->emailSuperUser = implode(',', Piwik::getAllSuperUserAccessEmailAddresses());
        }

        $capabilities = array();
        if ($this->idSite && $this->site) {
            $capabilityProvider = StaticContainer::get(Access\CapabilitiesProvider::class);
            foreach ($capabilityProvider->getAllCapabilities() as $capability) {
                if (Piwik::isUserHasCapability($this->idSite, $capability->getId())) {
                    $capabilities[] = $capability->getId();
                }
            }
        }

        $view->userCapabilities = $capabilities;

        $this->addCustomLogoInfo($view);

        $view->logoHeader = \Piwik\Plugins\API\API::getInstance()->getHeaderLogoUrl();
        $view->logoLarge = \Piwik\Plugins\API\API::getInstance()->getLogoUrl();
        $view->logoSVG = \Piwik\Plugins\API\API::getInstance()->getSVGLogoUrl();
        $view->hasSVGLogo = \Piwik\Plugins\API\API::getInstance()->hasSVGLogo();
        $view->superUserEmails = implode(',', Piwik::getAllSuperUserAccessEmailAddresses());
        $view->themeStyles = ThemeStyles::get();

        $general = PiwikConfig::getInstance()->General;
        $view->enableFrames = $general['enable_framed_pages']
            || (isset($general['enable_framed_logins']) && $general['enable_framed_logins']);
        $embeddedAsIframe = (Common::getRequestVar('module', '', 'string') == 'Widgetize');
        if (!$view->enableFrames && !$embeddedAsIframe) {
            $view->setXFrameOptions('sameorigin');
        }

        self::setHostValidationVariablesView($view);
    }
1260854
@Override
	protected void putVariables(Map<String, String> variables) {
		variables.put(ScopeFormat.SCOPE_HOST, hostname);
	}
567871
public function fetchHTTPPersistentVariables()
    {
        $translations = $this->allTranslations();

        $http = eZHTTPTool::instance();
        eZHTTPPersistence::fetch( 'ContentObjectState' , eZContentObjectState::definition(), $this, $http, false );
        eZHTTPPersistence::fetch( 'ContentObjectState' , eZContentObjectStateLanguage::definition(), $translations, $http, true );
    }
933050
public function getVariableForRead($name, CompilationContext $compilationContext = null, array $statement = null)
    {
        /*
         * Validate that 'this' cannot be used in a static function
         */
        if ('this' == $name || 'this_ptr' == $name) {
            if ($compilationContext->staticContext) {
                throw new CompilerException("Cannot use variable 'this' in static context", $statement);
            }
        }

        /*
         * Create superglobals just in time
         */
        if ($this->globalsManager->isSuperGlobal($name)) {
            if (!$this->hasVariable($name)) {
                /**
                 * @TODO, injecting globals, initialize to null and check first?
                 */
                $variable = new Variable('variable', $name, $compilationContext->branchManager->getCurrentBranch());
                $variable->setIsInitialized(true, $compilationContext);
                $variable->setDynamicTypes('array');
                $variable->setIsExternal(true);
                $this->addRawVariable($variable);
            } else {
                $variable = $this->getVariable($name);
            }
            $variable->increaseUses();

            return $variable;
        }

        if (!$this->hasVariable($name)) {
            throw new CompilerException("Cannot read variable '".$name."' because it wasn't declared", $statement);
        }

        $variable = $this->getVariable($name);
        if (!$variable->isInitialized()) {
            /* DON'T REMOVE THIS!! */
            throw new CompilerException("Variable '".$name."' cannot be read because it's not initialized", $statement);
        }

        $variable->increaseUses();

        /*
         * Analise branches to detect possible initialization of variables in conditional branches
         */
        if (!$variable->isTemporal() && !$variable->getSkipVariant()) {
            if ('return_value' != $name && 'this' != $name) {
                if (\is_object($compilationContext) && \is_object($compilationContext->branchManager)) {
                    if ($compilationContext->config->get('check-invalid-reads', 'optimizations')) {
                        switch ($variable->getType()) {
                            case 'variable':
                            case 'string':
                            case 'array':
                                if (!$variable->isLocalOnly()) {
                                    $variable->setMustInitNull(true);
                                }
                                break;
                        }
                    }

                    $initBranches = $variable->getInitBranches();

                    $currentBranch = $compilationContext->branchManager->getCurrentBranch();
                    /** @var Branch[] $branches */
                    $branches = array_reverse($initBranches);

                    if (1 == \count($branches)) {
                        if (Branch::TYPE_CONDITIONAL_TRUE == $branches[0]->getType()) {
                            if (true === $branches[0]->isUnreachable()) {
                                throw new CompilerException('Initialization of variable "'.$name.'" depends on unreachable branch, consider initialize it at its declaration', $statement);
                            }
                        } else {
                            if (Branch::TYPE_CONDITIONAL_FALSE == $branches[0]->getType()) {
                                if (false === $branches[0]->isUnreachable()) {
                                    throw new CompilerException('Initialization of variable "'.$name.'" depends on unreachable branch, consider initialize at its declaration', $statement);
                                }
                            }
                        }

                        $tempBranch = $branches[0]->getParentBranch();
                        while ($tempBranch) {
                            if (Branch::TYPE_CONDITIONAL_TRUE == $tempBranch->getType()) {
                                if (true === $tempBranch->isUnreachable()) {
                                    throw new CompilerException('Initialization of variable "'.$name.'" depends on unreachable branch, consider initialize it at its declaration', $statement);
                                }
                            }

                            $tempBranch = $tempBranch->getParentBranch();
                        }
                    }

                    $found = false;
                    foreach ($branches as $branch) {
                        /*
                         * Variable was initialized in the same current branch
                         */
                        if ($branch === $currentBranch) {
                            $found = true;
                            break;
                        }

                        /*
                         * 'root' and 'external' branches are safe branches
                         */
                        if (Branch::TYPE_ROOT == $branch->getType() || Branch::TYPE_EXTERNAL == $branch->getType()) {
                            $found = true;
                            break;
                        }
                    }

                    if (!$found) {
                        /**
                         * Check if last assignment
                         * Variable was initialized in a sub-branch and it's being used in a parent branch.
                         */
                        $possibleBadAssignment = false;

                        if ($currentBranch->getLevel() < $branches[0]->getLevel()) {
                            $possibleBadAssignment = true;
                        }

                        if ($possibleBadAssignment) {
                            if (\count($branches) > 1) {
                                $graph = new BranchGraph();
                                foreach ($branches as $branch) {
                                    $graph->addLeaf($branch);
                                }
                                //echo $graph->getRoot()->show();
                            } else {
                                /*
                                 * Variable is assigned just once and it's assigned in a conditional branch
                                 */
                                if (Branch::TYPE_CONDITIONAL_TRUE == $branches[0]->getType()) {
                                    $evalExpression = $branches[0]->getRelatedStatement()->getEvalExpression();

                                    if (true === $evalExpression->isUnreachable()) {
                                        throw new CompilerException("Variable '".$name."' was assigned for the first time in conditional branch, consider initialize it at its declaration", $statement);
                                    } else {
                                        $variable->enableDefaultAutoInitValue();
                                        $compilationContext->logger->warning(
                                            "Variable '".$name."' was assigned for the first time in conditional branch, consider initialize it at its declaration",
                                            ['conditional-initialization', $statement]
                                        );
                                    }
                                } else {
                                    if (Branch::TYPE_CONDITIONAL_FALSE == $branches[0]->getType()) {
                                        $evalExpression = $branches[0]->getRelatedStatement()->getEvalExpression();

                                        if (true === $evalExpression->isUnreachableElse()) {
                                            throw new CompilerException("Variable '".$name."' was assigned for the first time in conditional branch, consider initialize it at its declaration", $statement);
                                        } else {
                                            $variable->enableDefaultAutoInitValue();
                                            $compilationContext->logger->warning(
                                                "Variable '".$name."' was assigned for the first time in conditional branch, consider initialize it at its declaration",
                                                ['conditional-initialization', $statement]
                                            );
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }

        /*
         * Saves the latest place where the variable was used
         */
        $variable->setUsed(true, $statement);

        return $variable;
    }
473658
public function getVariableFromMaps($var, TransientVarsInterface $transientVars, PropertySetInterface $ps)
    {
        $firstDot = strpos($var, '.');
        $actualVar = $var;

        if (false !== $firstDot) {
            $actualVar = substr($var, 0, $firstDot);
        }


        $o = null;
        if ($transientVars->offsetExists($actualVar)) {
            $o = $transientVars->offsetGet($actualVar);
        }

        if (null === $o) {
            $o = $ps->getAsActualType($actualVar);
        }

        if (false !== $firstDot) {
            $property = substr($var, $firstDot + 1);
            $o = $this->getPropertyObject($o, $property);
        }

        return $o;
    }
1142229
private function staticVariableList() {
    $node = new StaticVariableStatementNode();
    $this->matchDocComment($node);
    $this->mustMatch(T_STATIC, $node);
    $variables = new CommaListNode();
    do {
      $variables->addChild($this->staticVariable());
    } while ($this->tryMatch(',', $variables));
    $node->addChild($variables, 'variables');
    $this->endStatement($node);
    return $node;
  }
1162462
public function build(): SetVariableValueRequest
	{
		$instance = new SetVariableValueRequest();
		if ($this->scopeNumber === null) {
			throw new BuilderException('Property [scopeNumber] is required.');
		}
		$instance->scopeNumber = $this->scopeNumber;
		if ($this->variableName === null) {
			throw new BuilderException('Property [variableName] is required.');
		}
		$instance->variableName = $this->variableName;
		if ($this->newValue === null) {
			throw new BuilderException('Property [newValue] is required.');
		}
		$instance->newValue = $this->newValue;
		if ($this->callFrameId === null) {
			throw new BuilderException('Property [callFrameId] is required.');
		}
		$instance->callFrameId = $this->callFrameId;
		return $instance;
	}