protected function getDirectoryRelativeToFile(string $configFile, ?string $directory = null): ?string
    {
        if (!$directory) {
            return null;
        }

        $path = realpath(dirname($configFile) . '/' . $directory);

        if (false !== $path) {
            return $path;
        }

        return $directory;
    }