@param string            $name
@param \PhpParser\Node[] $statements

@return \PhpParser\Node\Stmt\PropertyProperty|null
335406
protected function getPropertyRecursive(string $name, $statements)
    {
        foreach ($statements as $statement) {
            if ($statement instanceof \PhpParser\Node\Stmt\PropertyProperty && $statement->name == $name) {
                return $statement;
            } elseif (property_exists($statement, 'stmts')) {
                $result = $this->getPropertyRecursive($name, $statement->stmts);
            } elseif (property_exists($statement, 'expr')
                && property_exists($statement->expr, 'items')
            ) {
                $result = $this->getPropertyRecursive($name, $statement->expr->items);
            } elseif (property_exists($statement, 'default')
                && property_exists($statement->default, 'items')
            ) {
                $result = $this->getPropertyRecursive($name, $statement->default->items);
            } elseif (property_exists($statement, 'props')) {
                $result = $this->getPropertyRecursive($name, $statement->props);
            }
            if (!empty($result)) {
                return $result;
            }
        }

        return null;
    }
1188604
public static function generate($name, $properties)
	{
		/**
		 * $properties
		 *
		 * for Page : array(type, title, layout, body)
		 * for Post : array(type, title, layout, author, categories, body)
		 */
		$factory = new GenerateFactory(self::config($name), $properties);
		$generateNode = $factory->generate();
		$generateNode->generate();
		return $generateNode;
	}
591575
public function statement($name, $config = [])
    {
        $defaults = ['dialect' => $this];
        $config += $defaults;

        if (!isset($this->_classes[$name])) {
            throw new SqlException("Unsupported statement `'{$name}'`.");
        }
        $statement = $this->_classes[$name];
        return new $statement($config);
    }
451626
public function filterClassNames(array $statements)
    {
        $names = [];
        foreach ($this->filterClasses($statements) as $class) {
            $names[] = $class->name;
        }

        foreach ($this->filterNamespaces($statements) as $namespace) {
            foreach ($this->filterClasses($namespace->stmts) as $class) {
                $names[] = $namespace->name.'\\'.$class->name;
            }
        }

        return $names;
    }
164800
public function passStatementBlock(array $statements)
    {
        foreach ($statements as $statement) {
            switch ($statement['type']) {
                case 'let':
                    $this->passLetStatement($statement);
                    break;

                case 'echo':
                    if (isset($statement['expressions'])) {
                        foreach ($statement['expressions'] as $expr) {
                            $this->passExpression($expr);
                        }
                    }
                    break;

                case 'declare':
                    $this->declareVariables($statement);
                    break;

                case 'if':
                    if (isset($statement['expr'])) {
                        $this->passExpression($statement['expr']);
                    }
                    if (isset($statement['statements'])) {
                        $this->passStatementBlock($statement['statements']);
                    }
                    if (isset($statement['else_statements'])) {
                        $this->passStatementBlock($statement['else_statements']);
                    }
                    if (isset($statement['elseif_statements'])) {
                        $this->passStatementBlock($statement['elseif_statements']);
                    }
                    break;

                case 'switch':
                    if (isset($statement['expr'])) {
                        $this->passExpression($statement['expr']);
                    }
                    if (isset($statement['clauses'])) {
                        foreach ($statement['clauses'] as $clause) {
                            if (isset($clause['expr'])) {
                                $this->passExpression($clause['expr']);
                            }
                            if (isset($clause['statements'])) {
                                $this->passStatementBlock($clause['statements']);
                            }
                        }
                    }
                    break;

                case 'while':
                case 'do-while':
                    if (isset($statement['expr'])) {
                        $this->passExpression($statement['expr']);
                    }
                    if (isset($statement['statements'])) {
                        $this->passStatementBlock($statement['statements']);
                    }
                    break;

                case 'for':
                    if (isset($statement['expr'])) {
                        $this->passExpression($statement['expr']);
                    }
                    if (isset($statement['value'])) {
                        $this->increaseMutations($statement['value']);
                    }
                    if (isset($statement['key'])) {
                        $this->increaseMutations($statement['key']);
                    }
                    if (isset($statement['statements'])) {
                        $this->passStatementBlock($statement['statements']);
                    }
                    break;

                case 'return':
                    if (isset($statement['expr'])) {
                        $this->passExpression($statement['expr']);
                    }
                    break;

                case 'loop':
                    if (isset($statement['statements'])) {
                        $this->passStatementBlock($statement['statements']);
                    }
                    break;

                case 'try-catch':
                    if (isset($statement['statements'])) {
                        $this->passStatementBlock($statement['statements']);
                    }
                    if (isset($statement['catches'])) {
                        foreach ($statement['catches'] as $catch) {
                            if (isset($catch['variable'])) {
                                $this->increaseMutations($catch['variable']['value']);
                            }
                            if (isset($catch['statements'])) {
                                $this->passStatementBlock($catch['statements']);
                            }
                        }
                    }
                    break;

                case 'throw':
                    if (isset($statement['expr'])) {
                        $this->passExpression($statement['expr']);
                    }
                    break;

                case 'fetch':
                    $this->passExpression($statement['expr']);
                    break;

                case 'mcall':
                case 'scall':
                case 'fcall':
                case 'require':
                    $this->passCall($statement['expr']);
                    break;

                case 'unset':
                    if ('array-access' == $statement['expr']['type']) {
                        if ('variable' == $statement['expr']['left']['type']) {
                            $this->increaseMutations($statement['expr']['left']['value']);
                        }
                    } else {
                        if ('list' == $statement['expr']['type']) {
                            if ('array-access' == $statement['expr']['left']['type']) {
                                if ('variable' == $statement['expr']['left']['left']['type']) {
                                    $this->increaseMutations($statement['expr']['left']['left']['value']);
                                }
                            }
                        }
                    }
                    break;

                case 'break':
                case 'continue':
                case 'empty':
                case 'cblock':
                case 'comment':
                    break;

                default:
                    echo 'MutateGathererPassStatement=', $statement['type'], PHP_EOL;
            }
        }
    }
1282815
public function getProperty($name = null)
    {
        if (is_null($name)) {
            return null;
        }
        return $this->properties->get($name);
    }
1102592
public function getPropertyByName($name)
    {
        foreach ($this->properties as $property) {
            if ($property->getName() === $name) {
                return $property;
            }
        }
    }
954822
public function getEntityProperty($name)
    {
        if ($this->properties === null) {
            $this->createProperties();
        }
        return isset($this->properties[$name]) ? $this->properties[$name] : null;
    }
235327
public function get($name)
    {
        $name = '_' . (string)$name;
        return property_exists($this, $name) ? $this->$name : null;
    }
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;
    }
589275
function get($name){
        if(!isset($this->db[$name])){
            return null;
        }
        $r = $this->db[$name];
        return $r();
    }
1209819
public function getPropertyValue(string $name) {
		if (isset($this->dispatchables[$name])) {
			return $this->dispatchables[$name];
		}
		
		return null;
	}
380083
public function findStatementForNode(?Name $namespaceName, Name $node): ?Name
    {
        $name = strtolower($node->getFirst());

        $parentNode = ParentNodeAppender::findParent($node);

        if ($parentNode instanceof ClassLike
            && $node instanceof NamedIdentifier
            && $node->getOriginalNode() === $parentNode->name
        ) {
            // The current node can either be the class like name or one of its elements, e.g. extends or implements.
            // In the first case, the node was original an Identifier.

            return null;
        }

        $useStatements = $this->nodes[(string) $namespaceName] ?? [];

        foreach ($useStatements as $use_) {
            foreach ($use_->uses as $useStatement) {
                if (!($useStatement instanceof UseUse)) {
                    continue;
                }

                if ($name === $useStatement->getAlias()->toLowerString()) {
                    if ($this->isFunctionName($node, $parentNode)) {
                        if (Use_::TYPE_FUNCTION === $use_->type) {
                            return $useStatement->name;
                        }

                        continue;
                    }

                    if ($parentNode instanceof ConstFetch && 1 === count($node->parts)) {
                        if (Use_::TYPE_CONSTANT === $use_->type) {
                            return $useStatement->name;
                        }

                        continue;
                    }

                    // Match the alias
                    return $useStatement->name;
                }

                if (null !== $useStatement->alias) {
                    continue;
                }
            }
        }

        return null;
    }
1055242
public function findPropertyRequired(
        string $name
    ) {
        $class = get_class($this);

        return Property::getRequired(
            $this->getProperties(),
            $name,
            "Required property ({$name}) is missing in: {$class}"
        );
    }
260927
public function getLocalizedPropertyValues(NodeInterface $node, $name)
    {
        $values = [];
        foreach ($node->getProperties() as $property) {
            /* @var PropertyInterface $property */
            preg_match('/^' . $this->languageNamespace . ':([a-zA-Z_]*?)-' . $name . '/', $property->getName(), $matches);

            if ($matches) {
                $values[$matches[1]] = $property->getValue();
            }
        }

        return $values;
    }
1010966
public function getProperty($name) {
    $name = ltrim($name, '$');

    $properties = $this
      ->getProperties()
      ->filter(function (ClassMemberNode $property) use ($name) {
        return ltrim($property->getName(), '$') === $name;
      });
    return $properties->isEmpty() ? NULL : $properties[0];
  }
12673
public function getProperty($name): ?Property
    {
        if ($this->hasProperty($name)) {
            return $this->properties[$name];
        }

        return null;
    }