<?php


namespace AutoAdmin\Bundle\Core\Helper;


class DoctrineHelper
{
    const PROXY_PREFIX = 'Proxies\\__CG__\\';

    public static function getClass(object $object): array|string
    {
        return self::removeProxyPrefix(get_class($object));
    }

    public static function removeProxyPrefix(string $fqcn): array|string
    {
        if (strpos($fqcn, self::PROXY_PREFIX) === 0) {
            $fqcn = str_replace(self::PROXY_PREFIX, '', $fqcn);
        }

        return $fqcn;
    }
}
