![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/rentpix.corals.io/vendor/orchestra/canvas/src/Console/ |
<?php namespace Orchestra\Canvas\Console; use Illuminate\Support\Str; use Orchestra\Canvas\Core\Commands\GeneratorCommand; use Orchestra\Canvas\Core\Concerns\ResolvesPresetStubs; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Input\InputOption; #[AsCommand(name: 'preset', description: 'Create canvas.yaml for the project')] class PresetMakeCommand extends GeneratorCommand { use ResolvesPresetStubs; /** * The type of class being generated. * * @var string */ protected $type = 'Preset'; /** * Get the stub file for the generator. * * @return string */ protected function getStub() { $name = Str::lower($this->getNameInput()); $stub = __DIR__.'/stubs/preset'; return $this->files->exists("{$stub}.{$name}.stub") ? "{$stub}.{$name}.stub" : "{$stub}.laravel.stub"; } /** * Get the destination class path. * * @param string $name * @return string */ protected function getPath($name) { return $this->generatorPreset()->basePath().'/canvas.yaml'; } /** * Get the root namespace for the class. */ protected function rootNamespace(): string { $namespace = transform($this->option('namespace'), function (string $namespace) { return trim($namespace); }); if (! empty($namespace)) { return $namespace; } switch ($this->option('name')) { case 'package': return 'PackageName'; case 'laravel': default: return rtrim($this->laravel->getNamespace(), '\\'); } } /** * Get the console command options. * * @return array<int, array> */ protected function getOptions() { return [ ['namespace', null, InputOption::VALUE_OPTIONAL, 'Root namespace'], ]; } }