protected function populateStub(string $filename, string $stub, ?string $table = null): string
    {
        $search = ['{name}', '{table}'];
        $replace = [$filename, $table ?: 'dummy_table'];

        return str_replace($search, $replace, $stub);
    }