protected function fileNameforClass(string $className, string $type = 'main'): string
    {
        if (file_exists($this->rootpath->to('composer.json'))) {
            $composer = json_decode(
                    file_get_contents($this->rootpath->to('composer.json')),
                    true
            );
            if (isset($composer['autoload']['psr-4'])) {
                return $this->fileNameForPsr4(
                        $composer['autoload']['psr-4'],
                        $className,
                        $type
                );
            }
        }

        // assume psr-0 with standard stubbles pathes
        return $this->rootpath->to(
                'src',
                $type,
                'php',
                str_replace('\\', DIRECTORY_SEPARATOR, $className) . '.php'
        );
    }