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

Software: Apache. PHP/8.1.30 

uname -a: Linux server1.tuhinhossain.com 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC
2025 x86_64
 

uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root)  

Safe-mode: OFF (not secure)

/home/picotech/domains/smabpro.picotech.app/public_html/vendor/phpunit/phpunit/src/Logging/TestDox/   drwxr-xr-x
Free 28.65 GB of 117.98 GB (24.28%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     NamePrettifier.php (8.48 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php declare(strict_types=1);
/*
 * This file is part of PHPUnit.
 *
 * (c) Sebastian Bergmann <sebastian@phpunit.de>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
namespace PHPUnit\Logging\TestDox;

use function 
array_key_exists;
use function 
array_keys;
use function 
array_map;
use function 
array_pop;
use function 
array_values;
use function 
assert;
use function 
class_exists;
use function 
explode;
use function 
gettype;
use function 
implode;
use function 
in_array;
use function 
is_bool;
use function 
is_float;
use function 
is_int;
use function 
is_numeric;
use function 
is_object;
use function 
is_scalar;
use function 
method_exists;
use function 
preg_quote;
use function 
preg_replace;
use function 
range;
use function 
sprintf;
use function 
str_contains;
use function 
str_ends_with;
use function 
str_replace;
use function 
str_starts_with;
use function 
strlen;
use function 
strtolower;
use function 
strtoupper;
use function 
substr;
use function 
trim;
use 
PHPUnit\Framework\TestCase;
use 
PHPUnit\Metadata\Parser\Registry as MetadataRegistry;
use 
PHPUnit\Metadata\TestDox;
use 
PHPUnit\Util\Color;
use 
ReflectionEnum;
use 
ReflectionMethod;
use 
ReflectionObject;
use 
SebastianBergmann\Exporter\Exporter;

/**
 * @internal This class is not covered by the backward compatibility promise for PHPUnit
 */
final class NamePrettifier
{
    
/**
     * @psalm-var list<string>
     */
    
private static array $strings = [];

    
/**
     * @psalm-param class-string $className
     */
    
public function prettifyTestClassName(string $className): string
    
{
        if (
class_exists($className)) {
            
$classLevelTestDox MetadataRegistry::parser()->forClass($className)->isTestDox();

            if (
$classLevelTestDox->isNotEmpty()) {
                
$classLevelTestDox $classLevelTestDox->asArray()[0];

                
assert($classLevelTestDox instanceof TestDox);

                return 
$classLevelTestDox->text();
            }
        }

        
$parts     explode('\\'$className);
        
$className array_pop($parts);

        if (
str_ends_with($className'Test')) {
            
$className substr($className0strlen($className) - strlen('Test'));
        }

        if (
str_starts_with($className'Tests')) {
            
$className substr($classNamestrlen('Tests'));
        } elseif (
str_starts_with($className'Test')) {
            
$className substr($classNamestrlen('Test'));
        }

        if (empty(
$className)) {
            
$className 'UnnamedTests';
        }

        if (!empty(
$parts)) {
            
$parts[]            = $className;
            
$fullyQualifiedName implode('\\'$parts);
        } else {
            
$fullyQualifiedName $className;
        }

        
$result preg_replace('/(?<=[[:lower:]])(?=[[:upper:]])/u'' '$className);

        if (
$fullyQualifiedName !== $className) {
            return 
$result ' (' $fullyQualifiedName ')';
        }

        return 
$result;
    }

    public function 
prettifyTestMethodName(string $name): string
    
{
        
$buffer '';

        if (
$name === '') {
            return 
$buffer;
        }

        
$string = (string) preg_replace('#\d+$#'''$name, -1$count);

        if (
in_array($stringself::$stringstrue)) {
            
$name $string;
        } elseif (
$count === 0) {
            
self::$strings[] = $string;
        }

        if (
str_starts_with($name'test_')) {
            
$name substr($name5);
        } elseif (
str_starts_with($name'test')) {
            
$name substr($name4);
        }

        if (
$name === '') {
            return 
$buffer;
        }

        
$name[0] = strtoupper($name[0]);

        if (
str_contains($name'_')) {
            return 
trim(str_replace('_'' '$name));
        }

        
$wasNumeric false;

        foreach (
range(0strlen($name) - 1) as $i) {
            if (
$i && $name[$i] >= 'A' && $name[$i] <= 'Z') {
                
$buffer .= ' ' strtolower($name[$i]);
            } else {
                
$isNumeric is_numeric($name[$i]);

                if (!
$wasNumeric && $isNumeric) {
                    
$buffer .= ' ';
                    
$wasNumeric true;
                }

                if (
$wasNumeric && !$isNumeric) {
                    
$wasNumeric false;
                }

                
$buffer .= $name[$i];
            }
        }

        return 
$buffer;
    }

    public function 
prettifyTestCase(TestCase $testbool $colorize): string
    
{
        
$annotationWithPlaceholders false;
        
$methodLevelTestDox         MetadataRegistry::parser()->forMethod($test::class, $test->name())->isTestDox()->isMethodLevel();

        if (
$methodLevelTestDox->isNotEmpty()) {
            
$methodLevelTestDox $methodLevelTestDox->asArray()[0];

            
assert($methodLevelTestDox instanceof TestDox);

            
$result $methodLevelTestDox->text();

            if (
str_contains($result'$')) {
                
$annotation   $result;
                
$providedData $this->mapTestMethodParameterNamesToProvidedDataValues($test$colorize);

                
$variables array_map(
                    static fn (
string $variable): string => sprintf(
                        
'/%s(?=\b)/',
                        
preg_quote($variable'/'),
                    ),
                    
array_keys($providedData),
                );

                
$result trim(preg_replace($variables$providedData$annotation));

                
$annotationWithPlaceholders true;
            }
        } else {
            
$result $this->prettifyTestMethodName($test->name());
        }

        if (!
$annotationWithPlaceholders && $test->usesDataProvider()) {
            
$result .= $this->prettifyDataSet($test$colorize);
        }

        return 
$result;
    }

    public function 
prettifyDataSet(TestCase $testbool $colorize): string
    
{
        if (!
$colorize) {
            return 
$test->dataSetAsString();
        }

        if (
is_int($test->dataName())) {
            return 
Color::dim(' with data set ') . Color::colorize('fg-cyan', (string) $test->dataName());
        }

        return 
Color::dim(' with ') . Color::colorize('fg-cyan'Color::visualizeWhitespace($test->dataName()));
    }

    private function 
mapTestMethodParameterNamesToProvidedDataValues(TestCase $testbool $colorize): array
    {
        
assert(method_exists($test$test->name()));

        
/** @noinspection PhpUnhandledExceptionInspection */
        
$reflector = new ReflectionMethod($test::class, $test->name());

        
$providedData       = [];
        
$providedDataValues array_values($test->providedData());
        
$i                  0;

        
$providedData['$_dataName'] = $test->dataName();

        foreach (
$reflector->getParameters() as $parameter) {
            if (!
array_key_exists($i$providedDataValues) && $parameter->isDefaultValueAvailable()) {
                
$providedDataValues[$i] = $parameter->getDefaultValue();
            }

            
$value $providedDataValues[$i++] ?? null;

            if (
is_object($value)) {
                
$reflector = new ReflectionObject($value);

                if (
$reflector->isEnum()) {
                    
$enumReflector = new ReflectionEnum($value);

                    if (
$enumReflector->isBacked()) {
                        
$value $value->value;
                    } else {
                        
$value $value->name;
                    }
                } elseif (
$reflector->hasMethod('__toString')) {
                    
$value = (string) $value;
                } else {
                    
$value $value::class;
                }
            }

            if (!
is_scalar($value)) {
                
$value gettype($value);

                if (
$value === 'NULL') {
                    
$value 'null';
                }
            }

            if (
is_bool($value) || is_int($value) || is_float($value)) {
                
$value = (new Exporter)->export($value);
            }

            if (
$value === '') {
                if (
$colorize) {
                    
$value Color::colorize('dim,underlined''empty');
                } else {
                    
$value "''";
                }
            }

            
$providedData['$' $parameter->getName()] = $value;
        }

        if (
$colorize) {
            
$providedData array_map(
                static fn (
$value) => Color::colorize('fg-cyan'Color::visualizeWhitespace((string) $valuetrue)),
                
$providedData,
            );
        }

        return 
$providedData;
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

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

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