private function extractEntry($class)
    {
        if ($class != $this->baseClass && !is_subclass_of($class, $this->baseClass)) {
            return false;
        }

        if (!preg_match_all('~/?([a-zA-Z0-9]+)~', $class, $namespaces)) {
            throw new \Exception("Unexpected class {$class}.");
        }

        $prefix = $suffix = null;
        $parts = $namespaces[0];

        foreach ($parts as $index => $namespace) {
            if ($namespace == 'Component') {
                $prefix = strtolower($parts[$index + 1]);
                break;
            } elseif (preg_match('~([a-zA-Z0-9]+)Bundle~', $namespace, $matches)) {
                $prefix = strtolower($matches[1]);
                break;
            }
        }

        $suffix = strtolower(end($parts));

        if (empty($prefix) || empty($suffix)) {
            throw new \Exception(
                "Failed to extract discriminator value from class '{$class}'."
            );
        }

        $value = $prefix . '_' . $suffix;

        if (in_array($value, $this->map)) {
            throw new \Exception("Found duplicate discriminator map entry '{$value}' in {$class}");
        }

        $this->map[$class] = $value;

        return true;
    }
private function extractEntry($class)
    {
        if ($class != $this->baseClass && !is_subclass_of($class, $this->baseClass)) {
            return false;
        }

        if (!preg_match_all('~/?([a-zA-Z0-9]+)~', $class, $namespaces)) {
            throw new \Exception("Unexpected class {$class}.");
        }

        $prefix = $suffix = null;
        $parts = $namespaces[0];

        foreach ($parts as $index => $namespace) {
            if ($namespace == 'Component') {
                $prefix = strtolower($parts[$index + 1]);
                break;
            } elseif (preg_match('~([a-zA-Z0-9]+)Bundle~', $namespace, $matches)) {
                $prefix = strtolower($matches[1]);
                break;
            }
        }

        $suffix = strtolower(end($parts));

        if (empty($prefix) || empty($suffix)) {
            throw new \Exception(
                "Failed to extract discriminator value from class '{$class}'."
            );
        }

        $value = $prefix . '_' . $suffix;

        if (in_array($value, $this->map)) {
            throw new \Exception("Found duplicate discriminator map entry '{$value}' in {$class}");
        }

        $this->map[$class] = $value;

        return true;
    }
private function extractEntry ( $ class ) { if ( $ class != $ this -> baseClass && ! is_subclass_of ( $ class , $ this -> baseClass ) ) { return false ; } if ( ! preg_match_all ( '~/?([a-zA-Z0-9]+)~' , $ class , $ namespaces ) ) { throw new \ Exception ( "Unexpected class {$class}." ) ; } $ prefix = $ suffix = null ; $ parts = $ namespaces [ 0 ] ; foreach ( $ parts as $ index => $ namespace ) { if ( $ namespace == 'Component' ) { $ prefix = strtolower ( $ parts [ $ index + 1 ] ) ; break ; } elseif ( preg_match ( '~([a-zA-Z0-9]+)Bundle~' , $ namespace , $ matches ) ) { $ prefix = strtolower ( $ matches [ 1 ] ) ; break ; } } $ suffix = strtolower ( end ( $ parts ) ) ; if ( empty ( $ prefix ) || empty ( $ suffix ) ) { throw new \ Exception ( "Failed to extract discriminator value from class '{$class}'." ) ; } $ value = $ prefix . '_' . $ suffix ; if ( in_array ( $ value , $ this -> map ) ) { throw new \ Exception ( "Found duplicate discriminator map entry '{$value}' in {$class}" ) ; } $ this -> map [ $ class ] = $ value ; return true ; }
Extracts the discriminator name from the given class.

@param string $class

@return string

@return bool
@throws \Exception
Extracts the discriminator name from the given class .