public function createClassNameDetails(string $name, string $namespacePrefix, string $suffix = '', string $validationErrorMessage = ''): ClassNameDetails
    {
        $fullNamespacePrefix = $this->namespacePrefix.'\\'.$namespacePrefix;
        if ('\\' === $name[0]) {
            // class is already "absolute" - leave it alone (but strip opening \)
            $className = substr($name, 1);
        } else {
            $className = rtrim($fullNamespacePrefix, '\\').'\\'.Str::asClassName($name, $suffix);
        }

        Validator::validateClassName($className, $validationErrorMessage);

        // if this is a custom class, we may be completely different than the namespace prefix
        // the best way can do, is find the PSR4 prefix and use that
        if (0 !== strpos($className, $fullNamespacePrefix)) {
            $fullNamespacePrefix = $this->fileManager->getNamespacePrefixForClass($className);
        }

        return new ClassNameDetails($className, $fullNamespacePrefix, $suffix);
    }
public function createClassNameDetails(string $name, string $namespacePrefix, string $suffix = '', string $validationErrorMessage = ''): ClassNameDetails
    {
        $fullNamespacePrefix = $this->namespacePrefix.'\\'.$namespacePrefix;
        if ('\\' === $name[0]) {
            // class is already "absolute" - leave it alone (but strip opening \)
            $className = substr($name, 1);
        } else {
            $className = rtrim($fullNamespacePrefix, '\\').'\\'.Str::asClassName($name, $suffix);
        }

        Validator::validateClassName($className, $validationErrorMessage);

        // if this is a custom class, we may be completely different than the namespace prefix
        // the best way can do, is find the PSR4 prefix and use that
        if (0 !== strpos($className, $fullNamespacePrefix)) {
            $fullNamespacePrefix = $this->fileManager->getNamespacePrefixForClass($className);
        }

        return new ClassNameDetails($className, $fullNamespacePrefix, $suffix);
    }
public function createClassNameDetails ( string $ name , string $ namespacePrefix , string $ suffix = '' , string $ validationErrorMessage = '' ) : ClassNameDetails { $ fullNamespacePrefix = $ this -> namespacePrefix . '\\' . $ namespacePrefix ; if ( '\\' === $ name [ 0 ] ) { // class is already "absolute" - leave it alone (but strip opening \) $ className = substr ( $ name , 1 ) ; } else { $ className = rtrim ( $ fullNamespacePrefix , '\\' ) . '\\' . Str :: asClassName ( $ name , $ suffix ) ; } Validator :: validateClassName ( $ className , $ validationErrorMessage ) ; // if this is a custom class, we may be completely different than the namespace prefix // the best way can do, is find the PSR4 prefix and use that if ( 0 !== strpos ( $ className , $ fullNamespacePrefix ) ) { $ fullNamespacePrefix = $ this -> fileManager -> getNamespacePrefixForClass ( $ className ) ; } return new ClassNameDetails ( $ className , $ fullNamespacePrefix , $ suffix ) ; }
Creates a helper object to get data about a class name.

Examples:

// App\Entity\FeaturedProduct
$gen->createClassNameDetails('FeaturedProduct', 'Entity');
$gen->createClassNameDetails('featured product', 'Entity');

// App\Controller\FooController
$gen->createClassNameDetails('foo', 'Controller', 'Controller');

// App\Controller\Admin\FooController
$gen->createClassNameDetails('Foo\\Admin', 'Controller', 'Controller');

// App\Controller\Security\Voter\CoolController
$gen->createClassNameDetails('Cool', 'Security\Voter', 'Voter');

// Full class names can also be passed. Imagine the user has an autoload
// rule where Cool\Stuff lives in a "lib/" directory
// Cool\Stuff\BalloonController
$gen->createClassNameDetails('Cool\\Stuff\\Balloon', 'Controller', 'Controller');

@param string $name                   The short "name" that will be turned into the class name
@param string $namespacePrefix        Recommended namespace where this class should live, but *without* the "App\\" part
@param string $suffix                 Optional suffix to guarantee is on the end of the class
@param string $validationErrorMessage

@return ClassNameDetails
Creates a helper object to get data about a class name .