!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 

uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/uploads/script/vendor/nunomaduro/larastan/src/Rules/ModelProperties/   drwxr-xr-x
Free 12.98 GB of 57.97 GB (22.39%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     ModelPropertyStaticCallRule.php (4.96 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

declare(strict_types=1);

namespace 
NunoMaduro\Larastan\Rules\ModelProperties;

use 
Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use 
Illuminate\Database\Eloquent\Model;
use 
Illuminate\Database\Eloquent\Relations\Relation;
use 
Illuminate\Database\Query\Builder;
use 
NunoMaduro\Larastan\Reflection\EloquentBuilderMethodReflection;
use 
PhpParser\Node;
use 
PHPStan\Analyser\Scope;
use 
PHPStan\Reflection\ReflectionProvider;
use 
PHPStan\Rules\Rule;
use 
PHPStan\Rules\RuleLevelHelper;
use 
PHPStan\Type\Constant\ConstantStringType;
use 
PHPStan\Type\ErrorType;
use 
PHPStan\Type\ObjectType;
use 
PHPStan\Type\Type;

/**
 * @implements \PHPStan\Rules\Rule<\PhpParser\Node\Expr\StaticCall>
 */
class ModelPropertyStaticCallRule implements Rule
{
    
/** @var ReflectionProvider */
    
private $reflectionProvider;

    
/** @var ModelPropertiesRuleHelper */
    
private $modelPropertiesRuleHelper;

    
/** @var RuleLevelHelper */
    
private $ruleLevelHelper;

    public function 
__construct(ReflectionProvider $reflectionProviderModelPropertiesRuleHelper $ruleHelperRuleLevelHelper $ruleLevelHelper)
    {
        
$this->reflectionProvider $reflectionProvider;
        
$this->modelPropertiesRuleHelper $ruleHelper;
        
$this->ruleLevelHelper $ruleLevelHelper;
    }

    public function 
getNodeType(): string
    
{
        return 
Node\Expr\StaticCall::class;
    }

    
/**
     * @param Node\Expr\StaticCall $node
     * @param Scope                $scope
     *
     * @return string[]
     * @throws \PHPStan\ShouldNotHappenException|\PHPStan\Reflection\MissingMethodFromReflectionException
     */
    
public function processNode(Node $nodeScope $scope): array
    {
        if (! 
$node->name instanceof Node\Identifier) {
            return [];
        }

        if (
count($node->args) === 0) {
            return [];
        }

        
$methodName $node->name->name;

        
$class $node->class;

        if (
$class instanceof Node\Name) {
            
$className = (string) $class;
            
$lowercasedClassName strtolower($className);

            if (
in_array($lowercasedClassName, ['self''static'], true)) {
                if (! 
$scope->isInClass()) {
                    return [];
                }

                
$modelReflection $scope->getClassReflection();
            } elseif (
$lowercasedClassName === 'parent') {
                if (! 
$scope->isInClass()) {
                    return [];
                }

                
$currentClassReflection $scope->getClassReflection();

                if (
$currentClassReflection === null) {
                    return [];
                }

                if (
$currentClassReflection->getParentClass() === false) {
                    return [];
                }

                if (
$scope->getFunctionName() === null) {
                    throw new 
\PHPStan\ShouldNotHappenException();
                }

                
$modelReflection $currentClassReflection->getParentClass();
            } else {
                if (! 
$this->reflectionProvider->hasClass($className)) {
                    return [];
                }

                
$modelReflection $this->reflectionProvider->getClass($className);
            }
        } else {
            
$classTypeResult $this->ruleLevelHelper->findTypeToCheck(
                
$scope,
                
$class,
                
'',
                static function (
Type $type) use ($methodName): bool {
                    return 
$type->canCallMethods()->yes() && $type->hasMethod($methodName)->yes();
                }
            );

            
$classType $classTypeResult->getType();

            if (
$classType instanceof ErrorType) {
                return [];
            }

            if (
$classType instanceof ConstantStringType) {
                
$modelClassName $classType->getValue();
            } elseif (
$classType instanceof ObjectType) {
                
$modelClassName $classType->getClassName();
            } else {
                return [];
            }

            
$modelReflection $this->reflectionProvider->getClass($modelClassName);
        }

        if (
$modelReflection === null) {
            return [];
        }

        if (! 
$modelReflection->isSubclassOf(Model::class)) {
            return [];
        }

        if (! 
$modelReflection->hasMethod($methodName)) {
            return [];
        }

        
$methodReflection $modelReflection->getMethod($methodName$scope);

        if (
$methodReflection instanceof EloquentBuilderMethodReflection) {
            
$methodReflection $methodReflection->getOriginalMethodReflection();
        }

        
$className $methodReflection->getDeclaringClass()->getName();

        if (
$className !== Builder::class &&
            
$className !== EloquentBuilder::class &&
            
$className !== Relation::class &&
            
$className !== Model::class
        ) {
            return [];
        }

        return 
$this->modelPropertiesRuleHelper->check($methodReflection$scope$node->args$modelReflection);
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0138 ]--