It Replaces the view names in a given stub

@param string $stub
@param string $viewDirectory
@param string $routesPrefix
@param array $views

@return $this
769503
protected function replaceViewNames(&$stub, $viewDirectory, $routesPrefix, array $views = null)
    {
        foreach (($views ?: $this->views) as $view) {
            $viewName = $this->getDotNotationName($viewDirectory, $routesPrefix, $view);
            $viewTemplate = $this->getViewTemplateName($view);
            $stub = $this->strReplace($viewTemplate, $viewName, $stub);
        }

        return $this;
    }
1202405
private function getViewsFromModule(array $views)
	{
		foreach ($views as $key => $path)
			$this->views[$key] = $path;
	}
221756
protected function replaceCasts(&$stub, $fields){
        $casts = [];
        foreach ($fields as $f){
            if(!empty($f['casts'])) $casts[] = "\"{$f['name']}\"=>\"{$f['casts']}\"";
        }
        if(count($casts)) $casts = "protected \$casts = [".implode(',',$casts)."];";
        else $casts = "";

        $stub = str_replace('DummyCasts', $casts, $stub);

        return $this;
    }
654798
protected function replaceNamespace(&$stub, $name)
    {
        $stub = str_replace(
            ['DummyNamespace', 'DummyRootNamespace', 'NamespacedDummyUserModel'],
            [$this->getNamespace($name), $this->rootNamespace(), $this->userProviderModel()],
            $stub
        );

        return $this;
    }
1011601
protected function replaceEndpoint(string &$stub, string $endpoint)
    {

        if (strlen($endpoint) > 0)
            $stub = str_replace('/dummy/endpoint/', $endpoint, $stub);

        return $this;
    }
563947
protected function replaceModelNamespaceSegments(&$stub, $modelNamespace)
    {
        $modelSegments = explode('\\', $modelNamespace);
        foreach ($modelSegments as $key => $segment) {
            $stub = str_replace('{{modelNamespace[' . $key . ']}}', $segment, $stub);
        }

        $stub = preg_replace('{{modelNamespace\[\d*\]}}', '', $stub);

        return $this;
    }
171493
protected function processRoutesGroup(&$stub, $prefix, $namespace)
    {
        $prefix = trim($prefix);

        if (!empty($prefix) || !empty($namespace)) {
            $groupStub = $this->getStubContent('routes-group');

            $this->replacePrefix($groupStub, $this->getGroupPrefix($prefix))
                ->replaceRoutes($groupStub, $stub);

            $stub = $groupStub;
        }

        return $this;
    }
865529
protected function replaceRouteKeyName(&$stub, $route_key_name){

        if($route_key_name=='id')
            $replace = "";
        else{
            $replace = "public function getRouteKeyName(){ return \"{$route_key_name}\"; }";
        }

        $stub = str_replace('DummyRouteKeyName', $replace, $stub);

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

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

        return $this;
    }
301164
protected function replaceModelClass(&$stub, $name)
    {
        $stub = str_replace(
            ['DummyFullModelClass', 'DummyModelClass', 'DummyModelVariable'],
            [$name, class_basename($name), lcfirst(class_basename($name))],
            $stub
        );

        return $this;
    }
1064566
protected function getDestinationPath($viewsDirectory)
    {
        $path = Config::getViewsPath();

        if (!empty($viewsDirectory)) {
            $path .= Helpers::getPathWithSlash($viewsDirectory);
        }

        return $path;
    }
1249123
protected function replaceTableName(&$stub)
    {
        $table = $this->scaffoldCommandObj->getMeta()['table'];
        $stub = str_replace('{{table}}', $table, $stub);

        return $this;
    }
211939
protected function generateIndexContent($stub)
    {
        $content = str_replace(
            '{{LANDING}}',
            ucwords(config('larecipe.docs.landing')),
            $stub
        );

        $content = str_replace(
            '{{ROOT}}',
            config('larecipe.docs.route'),
            $content
        );

        $content = str_replace(
            '{{LANDINGSMALL}}',
            trim(config('larecipe.docs.landing'), '/'),
            $content
        );

        return $content;
    }
438404
protected function replaceSoftDelete(&$stub, $replaceSoftDelete)
    {
        if ($replaceSoftDelete == 'yes') {
            $stub = str_replace('{{softDeletes}}', "use SoftDeletes;\n    ", $stub);
            $stub = str_replace('{{useSoftDeletes}}', "use Illuminate\Database\Eloquent\SoftDeletes;\n", $stub);
        } else {
            $stub = str_replace('{{softDeletes}}', '', $stub);
            $stub = str_replace('{{useSoftDeletes}}', '', $stub);
        }

        return $this;
    }
1179088
protected function parseStub($stub, array $replacements = [])
    {
        foreach ($replacements as $key => $replacement) {
            $stub = str_replace('{{' . $key . '}}', $replacement, $stub);
        }

        return $stub;
    }
460846
public function setRoutePrefixes($routeNamePrefix, $routePatternPrefix)
    {
        $this->setRouteNamePrefix($routeNamePrefix);
        $this->setRoutePatternPrefix($routePatternPrefix);

        return $this;
    }
19743
protected function replaceNamespace(&$stub, $name)
    {
        $stub = str_replace('{{namespace}}', $this->getNamespace($name), $stub);

        $stub = str_replace('{{rootNamespace}}', $this->container->getNamespace(), $stub);

        return $this;
    }