public function getDescriptor(string $classNamespace): ?Descriptor
    {
        if (!$this->isEmpty()) {
            /** @var Descriptor $descriptor */
            foreach ($this as $rootNamespace => $descriptor) {
                $rootNamespace = $descriptor->getRootNamespace();

                $doubleSlashed = str_replace('\\', '\\\\', $rootNamespace);
                $pattern = sprintf('|^%s\\.*|', $doubleSlashed);

                if (preg_match($pattern, $classNamespace)) {
                    return $descriptor;
                }
            }
        }

        return null;
    }
public function getDescriptor(string $classNamespace): ?Descriptor
    {
        if (!$this->isEmpty()) {
            /** @var Descriptor $descriptor */
            foreach ($this as $rootNamespace => $descriptor) {
                $rootNamespace = $descriptor->getRootNamespace();

                $doubleSlashed = str_replace('\\', '\\\\', $rootNamespace);
                $pattern = sprintf('|^%s\\.*|', $doubleSlashed);

                if (preg_match($pattern, $classNamespace)) {
                    return $descriptor;
                }
            }
        }

        return null;
    }
public function getDescriptor ( string $ classNamespace ) : ? Descriptor { if ( ! $ this -> isEmpty ( ) ) { /** @var Descriptor $descriptor */ foreach ( $ this as $ rootNamespace => $ descriptor ) { $ rootNamespace = $ descriptor -> getRootNamespace ( ) ; $ doubleSlashed = str_replace ( '\\' , '\\\\' , $ rootNamespace ) ; $ pattern = sprintf ( '|^%s\\.*|' , $ doubleSlashed ) ; if ( preg_match ( $ pattern , $ classNamespace ) ) { return $ descriptor ; } } } return null ; }
Returns descriptor of bundle that contains given class

@param string $classNamespace Namespace of class for which descriptor of bundle should be returned
@return null|Descriptor
Returns descriptor of bundle that contains given class