Get the stub file for the generator.

@return string
337722
protected function getStub()
	{
		if ($this->option('queued') && $this->option('handler'))
		{
			return __DIR__.'/stubs/command-queued-with-handler.stub';
		}
		elseif ($this->option('queued'))
		{
			return __DIR__.'/stubs/command-queued.stub';
		}
		elseif ($this->option('handler'))
		{
			return __DIR__.'/stubs/command-with-handler.stub';
		}
		else
		{
			return __DIR__.'/stubs/command.stub';
		}
	}
360470
protected function generate()
    {
        foreach ($this->listFiles as $key => $file) {
            $filePath = $this->makeFilePath($this->listFolders[$key], $this->data['name']);

            $this->resolveByPath($filePath);

            $file = $this->formatContent($file);

            //
            $find = basename($filePath);

            $filePath = strrev(preg_replace(strrev("/$find/"), '', strrev($filePath), 1));

            $filePath = $filePath .$file;

            if ($this->files->exists($filePath)) {
                return $this->error($this->type .' already exists!');
            }

            $this->makeDirectory($filePath);

            foreach ($this->signOption as $option) {
                if ($this->option($option)) {
                    $stubFile = $this->listStubs[$option][$key];

                    $this->resolveByOption($this->option($option));

                    break;
                }
            }

            if (! isset($stubFile)) {
                $stubFile = $this->listStubs['default'][$key];
            }

            $this->files->put($filePath, $this->getStubContent($stubFile));
        }

        return $this->info($this->type.' created successfully.');
    }
1034397
public function getStub()
    {
        if ($this->plain) {
            return $this->getPath();
        }

        if ($template = $this->template) {
            return Stub::create($template, $this->getReplacements())->render();
        }

        return parent::getStub();
    }
783502
protected function buildRegisterFile()
    {
        $stubFiles = $this->getStub('register');

        $stub = $this->files->get($stubFiles);
        $this->replaceNamespace($stub);

        return $stub;
    }
1120712
public function getStubPeerBuilder()
    {
        if (!isset($this->stubPeerBuilder)) {
            $this->stubPeerBuilder = $this->getGeneratorConfig()->getConfiguredBuilder($this->getTable(), 'peerstub');
        }

        return $this->stubPeerBuilder;
    }
957805
protected function getStub()
    {
        return config('generators.' . strtolower($this->type) . ($this->input->hasOption('plain') && $this->option('plain') ? '_plain' : '') . '_stub');
    }
786099
protected function obtainRunnerFile(): string
    {
        $moduleInfos = $this->loadInfos;
        $runnerFile  = '';

        if (property_exists($moduleInfos, 'runner')) {
            $runnerFile = (string) $moduleInfos->runner;
        }

        if (empty($runnerFile)) {
            return '';
        }

        $runnerFile = MODULES_DIR.$this->name.'/'.$runnerFile;
        if (!file_exists($runnerFile)) {
            throw new Exception(
                'Runner file for module '.$this->name.' not found.',
                $this::ERR_RUNNER_FILE_NOT_FOUND
            );
        }

        return $runnerFile;
    }
716742
public function controller()
    {
        if ($this->restful) {
            return filesystem()->exists(realpath(__DIR__.'/../../../../../app/controllers')) ?
                realpath(__DIR__.'/../Templates/controller/restful.stub') :
                realpath(__DIR__.'/../Templates/controller/restful.core.stub');
        }

        return filesystem()->exists(realpath(__DIR__.'/../../../../../app/controllers')) ?
            realpath(__DIR__.'/../Templates/controller/plain.stub') :
            realpath(__DIR__.'/../Templates/controller/core.stub');
    }
7045
public function getStub()
    {
        $parser = $this->getNameParser();

        if ($this->existing) {
            $this->name = 'create_'.str_plural($this->name).'_table';
            
            $parser = $this->getNameParser();
                
            $fields = (new TableDumper($parser->getTable()))->toSchema();

            $stub = Stub::create('/migration/create.stub', [
                'class' => $this->getClass(),
                'table' => $parser->getTable(),
                'fields' => (new SchemaParser($fields))->render(),
            ]);
        }
        elseif ($parser->isCreate()) {
            $stub = Stub::create('/migration/create.stub', [
                'class' => $this->getClass(),
                'table' => $parser->getTable(),
                'fields' => $this->getSchemaParser()->render(),
            ]);
        } elseif ($parser->isAdd()) {
            $stub = Stub::create('/migration/add.stub', [
                'class' => $this->getClass(),
                'table' => $parser->getTable(),
                'fields_up' => $this->getSchemaParser()->up(),
                'fields_down' => $this->getSchemaParser()->down(),
            ]);
        } elseif ($parser->isDelete()) {
            $stub = Stub::create('/migration/delete.stub', [
                'class' => $this->getClass(),
                'table' => $parser->getTable(),
                'fields_down' => $this->getSchemaParser()->up(),
                'fields_up' => $this->getSchemaParser()->down(),
            ]);
        } elseif ($parser->isDrop()) {
            $stub = Stub::create('/migration/drop.stub', [
                'class' => $this->getClass(),
                'table' => $parser->getTable(),
                'fields' => $this->getSchemaParser()->render(),
            ]);
        } else {
            $stub = false;
        }

        if ($stub) {
            return $stub->render();
        }

        return parent::getStub();
    }
413775
protected function buildRegisterFile()
    {
        $stubFiles = $this->getStub('register');

        $stub = $this->files->get($stubFiles);
        $this->replaceStubFileData($stub);

        return $stub;
    }
162417
public function findingStub($stubName)
    {
        $stubRoots = $this->config->get('tie.stubs.path');
        foreach ($stubRoots as $stubRoot) {
            $stub = $stubRoot . '/' . $stubName . '.stub';
            if ($this->filesystem->exists($stub)) {
                return $stub;
            }
        }

        return '';
    }
904603
public function toArray()
    {
        if ($this->stub) {
            $json = ['stub' => true];
        } else {
            $json = ['data' => $this->getBase64EncodedData()];
            if ($this->contentType) {
                $json['content_type'] = $this->contentType;
            }
        }

        return $json;
    }
603256
protected function getStubContent($stubName)
    {
        $stubPath = $this->getStubsPath() .$stubName;

        $content = $this->files->get($stubPath);

        return $this->formatContent($content);
    }
789072
protected function getOptionStubKey()
    {
        $plain = $this->option('plain');
        $stub = $this->option('stub') . ($plain ? '_plain' : '') . '_stub';

        // if no stub, we assume its the same as the type
        if (is_null($this->option('stub'))) {
            $stub = $this->option('type') . ($plain ? '_plain' : '') . '_stub';
        }

        return $stub;
    }
457957
protected function getStub()
    {
        $stub = null;

        if ($this->option('parent')) {
            $stub = '/stubs/controller.nested.stub';
        } elseif ($this->option('model')) {
            $stub = '/stubs/controller.model.stub';
        } elseif ($this->option('resource')) {
            $stub = '/stubs/controller.stub';
        }

        if ($this->option('api') && is_null($stub)) {
            $stub = '/stubs/controller.api.stub';
        } elseif ($this->option('api') && ! is_null($stub)) {
            $stub = str_replace('.stub', '.api.stub', $stub);
        }

        $stub = $stub ?? '/stubs/controller.plain.stub';

        return __DIR__.$stub;
    }
404180
protected function getStub()
    {
        if (($t = $this->option('template')) && in_array($t, ['messages', 'notifications', 'tasks'], true)) {
            return __DIR__.'/stubs/badges/'.$t.'.stub';
        }

        return __DIR__.'/stubs/badges/messages.stub';
    }
978428
protected function getFileName(): string
    {
        if ($this->generatedFileName === null || Application::isCli()) {
            if ($this->fileNameFn !== null) {
                $this->generatedFileName = call_user_func($this->fileNameFn);
            } else {
                $this->generatedFileName = gmdate('Y-m-d') . '.log';
            }
        }

        return $this->generatedFileName;
    }