Build the transformer class using the given name and stub.

@param  string $name
@param  string $stub
@return string
549892
protected function makeTransformer(string $name, string $stub):string
    {
        $stub = $this->replaceNamespace($stub);
        $stub = $this->replaceClass($stub, $name);
        $stub = $this->replaceModel($stub, $name);

        return $stub;
    }
61492
protected function replaceClass($stub, $name)
    {
        $stub = parent::replaceClass($stub, $name);

        return str_replace('DummyModel', '\\'.trim((string) $this->argument('model'), '\\'), $stub);
    }
781631
protected function replaceClass($stub, $name)
    {
        $stub = str_replace('{{class}}',$this->parseName($name), $stub);
        return $stub;
    }
452722
protected function buildClass($name)
    {
        $stub = $this->files->get($this->getStub());

        $viewPath = $this->option('view-path') ? $this->option('view-path') . '.' : '';
        $crudName = strtolower($this->option('crud-name'));
        $crudNameSingular = str_singular($crudName);
        $modelName = $this->option('model-name');
        $modelNamespace = $this->option('model-namespace');
        $routeGroup = ($this->option('route-group')) ? $this->option('route-group') . '/' : '';
        $routePrefix = ($this->option('route-group')) ? $this->option('route-group') : '';
        $routePrefixCap = ucfirst($routePrefix);
        $perPage = intval($this->option('pagination'));
        $viewName = snake_case($this->option('crud-name'), '-');
        $fields = $this->option('fields');
        $validations = rtrim($this->option('validations'), ';');

        $validationRules = '';
        if (trim($validations) != '') {
            $validationRules = "\$this->validate(\$request, [";

            $rules = explode(';', $validations);
            foreach ($rules as $v) {
                if (trim($v) == '') {
                    continue;
                }

                // extract field name and args
                $parts = explode('#', $v);
                $fieldName = trim($parts[0]);
                $rules = trim($parts[1]);
                $validationRules .= "\n\t\t\t'$fieldName' => '$rules',";
            }

            $validationRules = substr($validationRules, 0, -1); // lose the last comma
            $validationRules .= "\n\t\t]);";
        }

        if (\App::VERSION() < '5.3') {
            $snippetUp = <<<EOD
        if (\$request->hasFile('{{fieldName}}')) {
            \$file = \$request->file('{{fieldName}}');
            \$fileName = str_random(40) . '.' . \$file->getClientOriginalExtension();
            \$destinationPath = storage_path('/app/public/uploads');
            \$file->move(\$destinationPath, \$fileName);
            \$requestData['{{fieldName}}'] = 'uploads/' . \$fileName;
        }
EOD;
        } else {
            $snippetCreateOne = <<<EOD
        if (\$request->has('{{fieldName}}')) {
            \${{fieldName}}Name = str_random(40) . '.' . \$request->{{fieldName}}->extension();
            \$requestData['{{fieldName}}'] = \${{fieldName}}Name;
        }
EOD;
            $snippetCreateTwo = <<<EOD
        if (\$request->has('{{fieldName}}')) {
            \$path = '/uploads/{{crudName}}/' . \$store->id . '/';
            Storage::makeDirectory(\$path );
            Image::make(\$request->{{fieldName}})->resize(120, 120, function (\$constraint) {
                \$constraint->aspectRatio();
            })->save(public_path(\$path . \${{fieldName}}Name));
            Image::make(\$request->{{fieldName}})->resize(300, 300, function (\$constraint) {
                \$constraint->aspectRatio();
            })->save(public_path(\$path . 'big' . \${{fieldName}}Name));
        }
EOD;
            $snippetUp = <<<EOD
        if (\$request->has('{{fieldName}}')) {
            \${{fieldName}}Name = str_random(40) . '.' . \$request->{{fieldName}}->extension();
            \$requestData['{{fieldName}}'] = \${{fieldName}}Name;
            \$path = '/uploads/{{crudName}}/' . \$up->id . '/';
            if (!empty(\$up->{{fieldName}})) {
                Storage::delete(\$path . \$up->{{fieldName}});
                Storage::delete(\$path . 'big' . \$up->{{fieldName}});
            }
            Storage::makeDirectory(\$path );
            Image::make(\$request->{{fieldName}})->resize(120, 120, function (\$constraint) {
                \$constraint->aspectRatio();
            })->save(public_path(\$path . \${{fieldName}}Name));
            Image::make(\$request->{{fieldName}})->resize(300, 300, function (\$constraint) {
                \$constraint->aspectRatio();
            })->save(public_path(\$path . 'big' . \${{fieldName}}Name));
        }
EOD;
            $snippetDelPicture = <<<EOD
        if (!empty(\$del->{{fieldName}})) {
            \$path = '/uploads/{{crudName}}/' . \$del->id . '/';
                Storage::deleteDirectory(\$path);
        }
EOD;
        }


        $fieldsArray = explode(';', $fields);
        $fileSnippetCreateOne = '';
        $fileSnippetCreateTwo = '';
        $fileSnippetUp = '';
        $fileSnippetDelPicture = '';
        $whereSnippet = '';

        if ($fields) {
            $x = 0;
            foreach ($fieldsArray as $index => $item) {
                $itemArray = explode('#', $item);

                if (trim($itemArray[1]) == 'file') {
                    $fileSnippetCreateOne .= str_replace(['{{fieldName}}', '{{crudName}}', '{{modelName}}'], [trim($itemArray[0]), $crudName, $modelName], $snippetCreateOne) . "\n";
                    $fileSnippetCreateTwo .= str_replace(['{{fieldName}}', '{{crudName}}', '{{modelName}}'], [trim($itemArray[0]), $crudName, $modelName], $snippetCreateTwo) . "\n";
                    $fileSnippetUp .= str_replace(['{{fieldName}}', '{{crudName}}', '{{modelName}}'], [trim($itemArray[0]), $crudName, $modelName], $snippetUp) . "\n";
                    $fileSnippetDelPicture .= str_replace(['{{fieldName}}', '{{crudName}}', '{{modelName}}'], [trim($itemArray[0]), $crudName, $modelName], $snippetDelPicture) . "\n";
                }

                $fieldName = trim($itemArray[0]);

                $whereSnippet .= ($index == 0) ? "where('$fieldName', 'LIKE', \"%\$keyword%\")" . "\n                " : "->orWhere('$fieldName', 'LIKE', \"%\$keyword%\")" . "\n                ";
            }

            $whereSnippet .= "->";
        }

        return $this->replaceNamespace($stub, $name)
            ->replaceViewPath($stub, $viewPath)
            ->replaceViewName($stub, $viewName)
            ->replaceCrudName($stub, $crudName)
            ->replaceCrudNameSingular($stub, $crudNameSingular)
            ->replaceModelName($stub, $modelName)
            ->replaceModelNamespace($stub, $modelNamespace)
            ->replaceModelNamespaceSegments($stub, $modelNamespace)
            ->replaceRouteGroup($stub, $routeGroup)
            ->replaceRoutePrefix($stub, $routePrefix)
            ->replaceRoutePrefixCap($stub, $routePrefixCap)
            ->replaceValidationRules($stub, $validationRules)
            ->replacePaginationNumber($stub, $perPage)
            ->replaceFileSnippetCreateOne($stub, $fileSnippetCreateOne)
            ->replaceFileSnippetCreateTwo($stub, $fileSnippetCreateTwo)
            ->replaceFileSnippetUp($stub, $fileSnippetUp)
            ->replaceFileSnippetDelPicture($stub, $fileSnippetDelPicture)
            ->replaceWhereSnippet($stub, $whereSnippet)
            ->replaceClass($stub, $name);
    }
242406
protected function buildClass($name)
    {
        $stub = $this->files->get($this->getStub());

        $table = $this->option('table') ?: $this->argument('name');
        $fillable = $this->option('fillable');

        return $this->replaceNamespace($stub, $name)
            ->replaceTable($stub, $table)
            ->replaceFillable($stub, $fillable)
            ->replaceClass($stub, $name);
    }
782705
protected function buildClass($name)
    {
        $stub = $this->files->get($this->getStub());

        $this->replaceNamespace($stub, $name);
        $this->replaceClassName($stub);
        $this->replaceSchema($stub);
        $this->replaceTableName($stub);

        return $stub;
    }
570173
protected function buildClass($name)
	{
		$stub = parent::buildClass($name);

		$event = $this->option('event');

		if ( ! starts_with($event, $this->getAppNamespace()))
		{
			$event = $this->getAppNamespace().'Events\\'.$event;
		}

		$stub = str_replace(
			'{{event}}', class_basename($event), $stub
		);

		$stub = str_replace(
			'{{fullEvent}}', $event, $stub
		);

		return $stub;
	}
1174224
protected function replace($stub, $name, $model)
    {
        $stub = $this->replaceClass($stub, $name);

        return str_replace(
            ['DummyModelNamespace', 'DummyModel'],
            [$model, class_basename($model)],
            $stub
        );
    }
753931
protected function buildClass($name)
    {
        $namespace = $this->getNamespace($name);

        $replace = [];

        if ($this->option('model')) {
            $replace = $this->buildModelReplacements($replace);
        }
        return str_replace(
            array_keys($replace), array_values($replace), parent::buildClass($name)
        );
    }
1137541
protected function replaceType($stub, $name)
    {
        preg_match('/([^\\\]+)$/', $name, $matches);
        $stub = str_replace(
            'DummyMutation',
            $matches[1],
            $stub
        );

        return $stub;
    }
1073011
protected function replaceNamespace(&$stub, $name)
    {
        $path = $this->option('path');
        $namespace = $this->option('namespace');

        if (!$namespace) {
            $namespace = $this->formGenerator->getClassInfo($name)->namespace;

            if ($path) {
                $namespace = str_replace('/', '\\', trim($path, '/'));
                foreach ($this->getAutoload() as $autoloadNamespace => $autoloadPath) {
                    if (preg_match('|'.$autoloadPath.'|', $path)) {
                        $namespace = str_replace([$autoloadPath, '/'], [$autoloadNamespace, '\\'], trim($path, '/'));
                    }
                }
            }
        }

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

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

        return $this;
    }
978967
protected function replaceClass($stub, $name)
    {
        $stub = parent::replaceClass($stub, $name);

        $type = basename(str_replace('\\', '/', strtolower($name)));
        if ($this->option('type')) {
            $type = $this->option('type');
        }

        return str_replace('dummy_type', $type, $stub);
    }
1204454
protected function buildClass($name)
    {
        $stub = parent::buildClass($name);

        $indexConfigurator = $this->getIndexConfigurator();

        $stub = str_replace(
            'DummyIndexConfigurator',
            $indexConfigurator ? "{$indexConfigurator}::class" : 'null', $stub
        );

        $searchRule = $this->getSearchRule();

        $stub = str_replace(
            'DummySearchRule',
            $searchRule ? "{$searchRule}::class" : '//', $stub
        );

        return $stub;
    }
1089914
protected function buildClass($name)
    {
        $stub = $this->files->get($this->getStub());

        return $this
            ->replaceNamespace($stub, $name)
            ->replaceModel($stub)
            ->replaceAbility($stub)
            ->replaceClass($stub, $name);
    }
1116645
protected function replaceClass($stub, $name)
    {
        $formGenerator = $this->formGenerator;

        $stub = str_replace(
            '{{class}}',
            $formGenerator->getClassInfo($name)->className,
            $stub
        );

        return str_replace(
            '{{fields}}',
            $formGenerator->getFieldsVariable($this->option('fields')),
            $stub
        );
    }
497605
protected function getStub($name = null)
    {
        if ($name == $this->qualifyClass('ModelPolicy')) return __DIR__.'/stubs/policy.model.stub';

        return $this->option('model')
            ? __DIR__.'/stubs/policy.stub'
            : parent::getStub();
    }