123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- <?php
-
-
- namespace Doctrine\Common\Util;
-
- use Doctrine\Common\Persistence\Proxy;
-
-
- class ClassUtils
- {
-
-
- public static function getRealClass($class)
- {
- if (false === $pos = strrpos($class, '\\'.Proxy::MARKER.'\\')) {
- return $class;
- }
-
- return substr($class, $pos + Proxy::MARKER_LENGTH + 2);
- }
-
-
-
- public static function getClass($object)
- {
- return self::getRealClass(get_class($object));
- }
-
-
-
- public static function getParentClass($className)
- {
- return get_parent_class( self::getRealClass( $className ) );
- }
-
-
-
- public static function newReflectionClass($class)
- {
- return new \ReflectionClass( self::getRealClass( $class ) );
- }
-
-
-
- public static function newReflectionObject($object)
- {
- return self::newReflectionClass( self::getClass( $object ) );
- }
-
-
-
- public static function generateProxyClassName($className, $proxyNamespace)
- {
- return rtrim($proxyNamespace, '\\') . '\\'.Proxy::MARKER.'\\' . ltrim($className, '\\');
- }
- }
|