Nwidart\Modules\Generators\ModuleGenerator::getReplacement PHP Method

getReplacement() protected method

Get array replacement for the specified stub.
protected getReplacement ( $stub ) : array
$stub
return array
    protected function getReplacement($stub)
    {
        $replacements = $this->module->config('stubs.replacements');
        if (!isset($replacements[$stub])) {
            return [];
        }
        $keys = $replacements[$stub];
        $replaces = [];
        foreach ($keys as $key) {
            if (method_exists($this, $method = 'get' . ucfirst(studly_case(strtolower($key))) . 'Replacement')) {
                $replaces[$key] = call_user_func([$this, $method]);
            } else {
                $replaces[$key] = null;
            }
        }
        return $replaces;
    }