File "IfStatement.php"
Full Path: /var/www/html/back/vendor/phpdocumentor/reflection/src/phpDocumentor/Reflection/Php/Factory/IfStatement.php
File size: 1.2 KB
MIME-type: text/x-php
Charset: utf-8
<?php
declare(strict_types=1);
namespace phpDocumentor\Reflection\Php\Factory;
use Override;
use phpDocumentor\Reflection\Php\ProjectFactoryStrategy;
use phpDocumentor\Reflection\Php\StrategyContainer;
use PhpParser\Node\Stmt\Else_;
use PhpParser\Node\Stmt\If_;
class IfStatement implements ProjectFactoryStrategy
{
#[Override]
public function matches(ContextStack $context, object $object): bool
{
return $object instanceof If_;
}
/** @param If_ $object */
#[Override]
public function create(ContextStack $context, object $object, StrategyContainer $strategies): void
{
foreach ($object->stmts as $stmt) {
$strategies->findMatching($context, $stmt)->create($context, $stmt, $strategies);
}
foreach ($object->elseifs as $elseIf) {
foreach ($elseIf->stmts as $stmt) {
$strategies->findMatching($context, $stmt)->create($context, $stmt, $strategies);
}
}
if (!($object->else instanceof Else_)) {
return;
}
foreach ($object->else->stmts as $stmt) {
$strategies->findMatching($context, $stmt)->create($context, $stmt, $strategies);
}
}
}