Build stub replacing the variable template.

@return string
356329
protected function buildFillable(&$stub)
    {
        $schemaArray = [];

        $schema = $this->scaffoldCommandObj->getMeta()['schema'];

        if ($schema)
        {
            $items = (new SchemaParser)->parse($schema);
            foreach($items as $item)
            {
                $schemaArray[] = "'{$item['name']}'";
            }

            $schemaArray = join(", ", $schemaArray);
        }

        $stub = str_replace('{{fillable}}', $schemaArray, $stub);

        return $this;
    }
313334
protected function replaceNamespace(string $stub):string
    {
        if (method_exists($this->laravel, 'getNameSpace')) {
            $namespace = $this->laravel->getNamespace() . 'Transformers';
        } else {
            $namespace = 'App\Transformers';
        }

        $stub = str_replace('DummyNamespace', $namespace, $stub);

        return $stub;
    }
12940
protected function replaceClass($stub, $name)
    {
        $class = str_replace($this->getNamespace($name).'\\', '', $name);
        $view = $this->getViewName();

        $stub = str_replace('DummyClass', $class, $stub);

        return str_replace('DummyTemplate', 'admin.dashboard.'.$view, $stub);
    }
1373329
public function buildTemplate()
    {
        if (!empty($this->template)) {
            return $this->template;
        }

        $actions = [];
        foreach ($this->actionBuilders as $actionBuilder) {
            $actions[] = $actionBuilder->buildTemplateAction();
        }

        $this->template = [
            'thumbnailImageUrl' => $this->thumbnailImageUrl,
            'title' => $this->title,
            'text' => $this->text,
            'actions' => $actions,
        ];

        if ($this->imageBackgroundColor) {
            $this->template['imageBackgroundColor'] = $this->imageBackgroundColor;
        }

        return $this->template;
    }
65648
protected function buildDefault()
    {
        $attribStrings = $this->buildAttribStrings($this->props);
        $props = \array_merge($this->props, $attribStrings);
        if (empty($props['input'])) {
            // $props['attribs'] is already a string, but that's OK
            $this->props['input'] = Html::buildTag($props['tagname'], $props['attribs']);
            $props['input'] = $this->buildInputGroup();
        }
        return $props['tagOnly']
            ? $props['input']
            : Str::quickTemp($props['template'], $props);
    }
1329398
protected function replaceUserNamespace($stub): string
    {
        if (! $userModel = config('auth.providers.'.config('auth.guards.'.config('auth.defaults.guard').'.provider').'.model')) {
            return $stub;
        }

        return str_replace(
            $this->rootNamespace().'User',
            $userModel,
            $stub
        );
    }
953673
protected function template()
    {
        $reflector = new \ReflectionClass(get_class($this));
        $classname = $reflector->getName();

        $template = preg_replace('/(Application|Synapse)\\\View\\\/', '', $classname);
        $template = str_replace('\\', '/', $template);

        return $template;
    }
694439
public function templateOptionsStructure()
    {
        if ($this->areTemplateOptionsFinalized === false) {
            $this->areTemplateOptionsFinalized = true;
            $this->prepareTemplateOptions();
        }

        $key  = 'template_options';
        $prop = $this->property($key);
        $val  = $this->propertyValue($key);
        $obj  = $prop->structureVal($val, $this->templateOptionsMetadata());

        return $obj;
    }
211116
protected function replaceModel($stub, $model)
    {
        $model = str_replace('/', '\\', $model);

        $namespaceModel = $this->container->getNamespace() .'Models\\' .$model;

        if (Str::startsWith($model, '\\')) {
            $stub = str_replace('{{fullModel}}', trim($model, '\\'), $stub);
        } else {
            $stub = str_replace('{{fullModel}}', $namespaceModel, $stub);
        }

        $stub = str_replace(
            "use {$namespaceModel};\nuse {$namespaceModel};", "use {$namespaceModel};", $stub
        );

        $model = class_basename(trim($model, '\\'));

        $stub = str_replace('{{model}}', $model, $stub);

        $stub = str_replace('{{camelModel}}', Str::camel($model), $stub);

        return str_replace('{{pluralModel}}', Str::plural(Str::camel($model)), $stub);
    }
190330
public function getStub()
    {
        $path = config('repository.generator.stubsOverridePath', __DIR__);

        if(!file_exists($path . '/Stubs/' . $this->stub . '.stub')){
            $path = __DIR__;
        }

        return (new Stub($path . '/Stubs/' . $this->stub . '.stub', $this->getReplacements()))->render();
    }
231339
public function replace() {

		if(null !== $this -> match) {

			foreach($this -> match[0] as $index => $match) {

				if(false === in_array($match, TemplateData :: $localVariables)) {

					$code = ParseVariable :: parse($match);
					$this -> line = preg_replace('#' . preg_quote($this -> match[0][$index]) . '#', $code, $this -> line);
				}
			}
		}

		return $this;
	}
904148
public function compile($stub, $modelName, $modelData, stdClass $scaffolderConfig, $hash, array $extensions, $extra = null)
    {
        $this->stub = $stub;

        $this->replaceResource($modelName);

        return $this->stub;
    }
770515
public function ___build(): string
    {
        $tables = \implode(', ', $this->tables);
        $fields = \implode(', ', $this->fields);
        $where = $orderBy = $limit = '';

        if ($this->where != '') {
            $where = \sprintf(' WHERE %s', $this->where);
        }
        if (\count($this->orderBy) > 0) {
            $orderBy = \sprintf(' ORDER BY %s', \implode(', ', $this->orderBy));
        }
        if ($this->limit != 0) {
            $limit = \sprintf(' LIMIT %s', $this->limit);
        }

        return \sprintf('UPDATE %s SET %s%s%s%s', $tables, $fields, $where, $orderBy, $limit);
    }
181409
protected function replaceModel($stub, $model)
    {
        $model = str_replace('/', '\\', $model);

        $namespaceModel = $this->laravel->getNamespace().$model;

        if (Str::startsWith($model, '\\')) {
            $stub = str_replace('NamespacedDummyModel', trim($model, '\\'), $stub);
        } else {
            $stub = str_replace('NamespacedDummyModel', $namespaceModel, $stub);
        }

        $stub = str_replace(
            "use {$namespaceModel};\nuse {$namespaceModel};", "use {$namespaceModel};", $stub
        );

        $model = class_basename(trim($model, '\\'));

        $dummyUser = class_basename($this->userProviderModel());

        $dummyModel = Str::camel($model) === 'user' ? 'model' : $model;

        $stub = str_replace('DocDummyModel', Str::snake($dummyModel, ' '), $stub);

        $stub = str_replace('DummyModel', $model, $stub);

        $stub = str_replace('dummyModel', Str::camel($dummyModel), $stub);

        $stub = str_replace('DummyUser', $dummyUser, $stub);

        return str_replace('DocDummyPluralModel', Str::snake(Str::pluralStudly($dummyModel), ' '), $stub);
    }
1249123
protected function replaceTableName(&$stub)
    {
        $table = $this->scaffoldCommandObj->getMeta()['table'];
        $stub = str_replace('{{table}}', $table, $stub);

        return $this;
    }
408633
public function ___build(): string
    {
        $tables = \implode(', ', $this->from);
        $where = $limit = '';

        if ($this->where !== '') {
            $where = \sprintf(' WHERE %s', $this->where);
        }
        if ($this->limit !== 0) {
            $limit = \sprintf(' LIMIT %s', $this->limit);
        }

        return \sprintf('DELETE FROM %s%s%s', $tables, $where, $limit);
    }
1310072
protected function replaceModel($stub, $model)
    {
        $model = str_replace('/', '\\', $model);

        $namespaceModel =
            trim($this->laravel->getNamespace(), '\\')
            . $this->getModuleNamespace()
            . config('stubs.namespaces.model') . '\\'
            . $model;

        if (Str::startsWith($model, '\\')) {
            $stub = str_replace('NamespacedDummyModel', trim($model, '\\'), $stub);
        } else {
            $stub = str_replace('NamespacedDummyModel', $namespaceModel, $stub);
        }

        $stub = str_replace(
            "use {$namespaceModel};\nuse {$namespaceModel};", "use {$namespaceModel};", $stub
        );

        $model = class_basename(trim($model, '\\'));
        $stub = str_replace('DocDummyModel', Str::snake($model, ' '), $stub);
        $stub = str_replace('DummyModel', $model, $stub);

        return str_replace('dummyModel', Str::camel($model), $stub);
    }