REDROOM
PHP 8.2.31
Path:
Logout
Edit File
Size: 1.71 KB
Close
//opt/cpanel/ea-wappspector/vendor/rector/rector/rules/DeadCode/NodeManipulator/ControllerClassMethodManipulator.php
Text
Base64
<?php declare (strict_types=1); namespace Rector\DeadCode\NodeManipulator; use PhpParser\Node\Name; use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\ClassMethod; use PHPStan\PhpDocParser\Ast\PhpDoc\GenericTagValueNode; use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory; use Rector\NodeNameResolver\NodeNameResolver; final class ControllerClassMethodManipulator { /** * @readonly * @var \Rector\NodeNameResolver\NodeNameResolver */ private $nodeNameResolver; /** * @readonly * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ private $phpDocInfoFactory; public function __construct(NodeNameResolver $nodeNameResolver, PhpDocInfoFactory $phpDocInfoFactory) { $this->nodeNameResolver = $nodeNameResolver; $this->phpDocInfoFactory = $phpDocInfoFactory; } public function isControllerClassMethod(Class_ $class, ClassMethod $classMethod) : bool { if (!$classMethod->isPublic()) { return \false; } if (!$this->hasParentClassController($class)) { return \false; } $phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($classMethod); return $phpDocInfo->hasByType(GenericTagValueNode::class); } private function hasParentClassController(Class_ $class) : bool { if (!$class->extends instanceof Name) { return \false; } $parentClassName = $this->nodeNameResolver->getName($class->extends); if (\substr_compare($parentClassName, 'Controller', -\strlen('Controller')) === 0) { return \true; } return \substr_compare($parentClassName, 'Presenter', -\strlen('Presenter')) === 0; } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 5
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
ClassMethodParamRemover.php
1.35 KB
lrw-r--r--
2024-11-08 13:59:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ControllerClassMethodManipulator.php
1.71 KB
lrw-r--r--
2024-11-08 13:59:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
CountManipulator.php
3.88 KB
lrw-r--r--
2024-11-08 13:59:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
LivingCodeManipulator.php
4.35 KB
lrw-r--r--
2024-11-08 13:59:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
VariadicFunctionLikeDetector.php
1.62 KB
lrw-r--r--
2024-11-08 13:59:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).