protected function findFile($className)
    {
        $genDir = $this->getGenerationDir();

        if (!$genDir) {
            return null;
        }

        $path = [$genDir];
        $path[] =  str_replace('\\', DIRECTORY_SEPARATOR, $className) . '.php';

        $path = implode(DIRECTORY_SEPARATOR, $path);

        $dir = dirname($path);

        if (!is_dir($dir) && !@mkdir($dir, 0777, true)) {
            $e = error_get_last();
            throw new \RuntimeException(
                "Failed to create class generation folder: " . $e['message']
            );
        }

        return $path;
    }