芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/kwesioben.com/paymoney/vendor/livewire/livewire/src/Commands/MakeCommand.php
parser = new ComponentParser( config('livewire.class_namespace'), config('livewire.view_path'), $this->argument('name'), $this->option('stub') ); if (!$this->isClassNameValid($name = $this->parser->className())) { $this->line("
WHOOPS! > 😳 \n"); $this->line("
Class is invalid:> {$name}"); return; } if ($this->isReservedClassName($name)) { $this->line("
WHOOPS! > 😳 \n"); $this->line("
Class is reserved:> {$name}"); return; } $force = $this->option('force'); $inline = $this->option('inline'); $test = $this->option('test'); $showWelcomeMessage = $this->isFirstTimeMakingAComponent(); $class = $this->createClass($force, $inline); $view = $this->createView($force, $inline); if ($test) { $test = $this->createTest($force); } $this->refreshComponentAutodiscovery(); if($class || $view) { $this->line("
COMPONENT CREATED > 🤙\n"); $class && $this->line("
CLASS:> {$this->parser->relativeClassPath()}"); if (! $inline) { $view && $this->line("
VIEW:> {$this->parser->relativeViewPath()}"); } if ($test) { $test && $this->line("
TEST:> {$this->parser->relativeTestPath()}"); } if ($showWelcomeMessage && ! app()->runningUnitTests()) { $this->writeWelcomeMessage(); } } } protected function createClass($force = false, $inline = false) { $classPath = $this->parser->classPath(); if (File::exists($classPath) && ! $force) { $this->line("
WHOOPS-IE-TOOTLES > 😳 \n"); $this->line("
Class already exists:> {$this->parser->relativeClassPath()}"); return false; } $this->ensureDirectoryExists($classPath); File::put($classPath, $this->parser->classContents($inline)); return $classPath; } protected function createView($force = false, $inline = false) { if ($inline) { return false; } $viewPath = $this->parser->viewPath(); if (File::exists($viewPath) && ! $force) { $this->line("
View already exists:> {$this->parser->relativeViewPath()}"); return false; } $this->ensureDirectoryExists($viewPath); File::put($viewPath, $this->parser->viewContents()); return $viewPath; } protected function createTest($force = false) { $testPath = $this->parser->testPath(); if (File::exists($testPath) && ! $force) { $this->line("
WHOOPS-IE-TOOTLES > 😳 \n"); $this->line("
Test class already exists:> {$this->parser->relativeTestPath()}"); return false; } $this->ensureDirectoryExists($testPath); File::put($testPath, $this->parser->testContents()); return $testPath; } public function isClassNameValid($name) { return preg_match("/^[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*$/", $name); } public function isReservedClassName($name) { return array_search(strtolower($name), $this->getReservedName()) !== false; } private function getReservedName() { return [ 'parent', 'component', 'interface', '__halt_compiler', 'abstract', 'and', 'array', 'as', 'break', 'callable', 'case', 'catch', 'class', 'clone', 'const', 'continue', 'declare', 'default', 'die', 'do', 'echo', 'else', 'elseif', 'empty', 'enddeclare', 'endfor', 'endforeach', 'endif', 'endswitch', 'endwhile', 'eval', 'exit', 'extends', 'final', 'finally', 'fn', 'for', 'foreach', 'function', 'global', 'goto', 'if', 'implements', 'include', 'include_once', 'instanceof', 'insteadof', 'interface', 'isset', 'list', 'namespace', 'new', 'or', 'print', 'private', 'protected', 'public', 'require', 'require_once', 'return', 'static', 'switch', 'throw', 'trait', 'try', 'unset', 'use', 'var', 'while', 'xor', 'yield', ]; } }