芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/kwesioben.com/paymoney/vendor/livewire/livewire/src/Commands/MoveCommand.php
parser = new ComponentParser( config('livewire.class_namespace'), config('livewire.view_path'), $this->argument('name') ); $this->newParser = new ComponentParserFromExistingComponent( config('livewire.class_namespace'), config('livewire.view_path'), $this->argument('new-name'), $this->parser ); $inline = $this->option('inline'); $class = $this->renameClass(); if (! $inline) $view = $this->renameView(); $test = $this->renameTest(); $this->refreshComponentAutodiscovery(); if ($class) $this->line("
COMPONENT MOVED > 🤙\n"); $class && $this->line("
CLASS:> {$this->parser->relativeClassPath()}
=>> {$this->newParser->relativeClassPath()}"); if (! $inline) $view && $this->line("
VIEW:> {$this->parser->relativeViewPath()}
=>> {$this->newParser->relativeViewPath()}"); if ($test) $test && $this->line("
Test:> {$this->parser->relativeTestPath()}
=>> {$this->newParser->relativeTestPath()}"); } protected function renameClass() { if (File::exists($this->newParser->classPath())) { $this->line("
WHOOPS-IE-TOOTLES > 😳 \n"); $this->line("
Class already exists:> {$this->newParser->relativeClassPath()}"); return false; } $this->ensureDirectoryExists($this->newParser->classPath()); File::put($this->newParser->classPath(), $this->newParser->classContents()); return File::delete($this->parser->classPath()); } protected function renameView() { $newViewPath = $this->newParser->viewPath(); if (File::exists($newViewPath)) { $this->line("
View already exists:> {$this->newParser->relativeViewPath()}"); return false; } $this->ensureDirectoryExists($newViewPath); File::move($this->parser->viewPath(), $newViewPath); return $newViewPath; } protected function renameTest() { $oldTestPath = $this->parser->testPath(); $newTestPath = $this->newParser->testPath(); if (!File::exists($oldTestPath) || File::exists($newTestPath)) { return false; } $this->ensureDirectoryExists($newTestPath); File::move($oldTestPath, $newTestPath); return $newTestPath; } }