!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)

/var/www/html/laravel-crm/vendor/laravel/framework/src/Illuminate/Foundation/Console/   drwxrwxrwx
Free 13.16 GB of 57.97 GB (22.7%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


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

namespace Illuminate\Foundation\Console;

use 
Illuminate\Console\Concerns\CreatesMatchingTest;
use 
Illuminate\Console\GeneratorCommand;
use 
Illuminate\Foundation\Inspiring;
use 
Illuminate\Support\Facades\File;
use 
Illuminate\Support\Str;
use 
Symfony\Component\Console\Attribute\AsCommand;
use 
Symfony\Component\Console\Input\InputOption;

#[
AsCommand(name'make:view')]
class 
ViewMakeCommand extends GeneratorCommand
{
    use 
CreatesMatchingTest;

    
/**
     * The console command description.
     *
     * @var string
     */
    
protected $description 'Create a new view';

    
/**
     * The name and signature of the console command.
     *
     * @var string
     */
    
protected $name 'make:view';

    
/**
     * The type of file being generated.
     *
     * @var string
     */
    
protected $type 'View';

    
/**
     * Build the class with the given name.
     *
     * @param  string  $name
     * @return string
     *
     * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
     */
    
protected function buildClass($name)
    {
        
$contents parent::buildClass($name);

        return 
str_replace(
            
'{{ quote }}',
            
Inspiring::quotes()->random(),
            
$contents,
        );
    }

    
/**
     * Get the destination view path.
     *
     * @param  string  $name
     * @return string
     */
    
protected function getPath($name)
    {
        return 
$this->viewPath(
            
$this->getNameInput().'.'.$this->option('extension'),
        );
    }

    
/**
     * Get the desired view name from the input.
     *
     * @return string
     */
    
protected function getNameInput()
    {
        
$name trim($this->argument('name'));

        
$name str_replace(['\\''.'], '/'$this->argument('name'));

        return 
$name;
    }

    
/**
     * Get the stub file for the generator.
     *
     * @return string
     */
    
protected function getStub()
    {
        return 
$this->resolveStubPath(
            
'/stubs/view.stub',
        );
    }

    
/**
     * Resolve the fully-qualified path to the stub.
     *
     * @param  string  $stub
     * @return string
     */
    
protected function resolveStubPath($stub)
    {
        return 
file_exists($customPath $this->laravel->basePath(trim($stub'/')))
                        ? 
$customPath
                        
__DIR__.$stub;
    }

    
/**
     * Get the destination test case path.
     *
     * @return string
     */
    
protected function getTestPath()
    {
        return 
base_path(
            
Str::of($this->testClassFullyQualifiedName())
                ->
replace('\\''/')
                ->
replaceFirst('Tests/Feature''tests/Feature')
                ->
append('Test.php')
                ->
value()
        );
    }

    
/**
     * Create the matching test case if requested.
     *
     * @param  string  $path
     */
    
protected function handleTestCreation($path): bool
    
{
        if (! 
$this->option('test') && ! $this->option('pest')) {
            return 
false;
        }

        
$contents preg_replace(
            [
'/\{{ namespace \}}/''/\{{ class \}}/''/\{{ name \}}/'],
            [
$this->testNamespace(), $this->testClassName(), $this->testViewName()],
            
File::get($this->getTestStub()),
        );

        
File::ensureDirectoryExists(dirname($this->getTestPath()), 0755true);

        return 
File::put($this->getTestPath(), $contents);
    }

    
/**
     * Get the namespace for the test.
     *
     * @return string
     */
    
protected function testNamespace()
    {
        return 
Str::of($this->testClassFullyQualifiedName())
            ->
beforeLast('\\')
            ->
value();
    }

    
/**
     * Get the class name for the test.
     *
     * @return string
     */
    
protected function testClassName()
    {
        return 
Str::of($this->testClassFullyQualifiedName())
            ->
afterLast('\\')
            ->
append('Test')
            ->
value();
    }

    
/**
     * Get the class fully qualified name for the test.
     *
     * @return string
     */
    
protected function testClassFullyQualifiedName()
    {
        
$name Str::of(Str::lower($this->getNameInput()))->replace('.'.$this->option('extension'), '');

        
$namespacedName Str::of(
            
Str::of($name)
                ->
replace('/'' ')
                ->
explode(' ')
                ->
map(fn ($part) => Str::of($part)->ucfirst())
                ->
implode('\\')
        )
            ->
replace(['-''_'], ' ')
            ->
explode(' ')
            ->
map(fn ($part) => Str::of($part)->ucfirst())
            ->
implode('');

        return 
'Tests\\Feature\\View\\'.$namespacedName;
    }

    
/**
     * Get the test stub file for the generator.
     *
     * @return string
     */
    
protected function getTestStub()
    {
        
$stubName 'view.'.($this->option('pest') ? 'pest' 'test').'.stub';

        return 
file_exists($customPath $this->laravel->basePath("stubs/$stubName"))
            ? 
$customPath
            
__DIR__.'/stubs/'.$stubName;
    }

    
/**
     * Get the view name for the test.
     *
     * @return string
     */
    
protected function testViewName()
    {
        return 
Str::of($this->getNameInput())
            ->
replace('/''.')
            ->
lower()
            ->
value();
    }

    
/**
     * Get the console command arguments.
     *
     * @return array
     */
    
protected function getOptions()
    {
        return [
            [
'extension'nullInputOption::VALUE_OPTIONAL'The extension of the generated view''blade.php'],
            [
'force''f'InputOption::VALUE_NONE'Create the view even if the view already exists'],
        ];
    }
}

:: 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.0054 ]--