Neos\Flow\Mvc\ActionRequest::getControllerObjectName PHP Метод

getControllerObjectName() публичный Метод

Returns the object name of the controller defined by the package key and controller name
public getControllerObjectName ( ) : string
Результат string The controller's Object Name
    public function getControllerObjectName()
    {
        $possibleObjectName = '@package\\@subpackage\\Controller\\@controllerController';
        $possibleObjectName = str_replace('@package', str_replace('.', '\\', $this->controllerPackageKey), $possibleObjectName);
        $possibleObjectName = str_replace('@subpackage', $this->controllerSubpackageKey, $possibleObjectName);
        $possibleObjectName = str_replace('@controller', $this->controllerName, $possibleObjectName);
        $possibleObjectName = str_replace('\\\\', '\\', $possibleObjectName);
        $controllerObjectName = $this->objectManager->getCaseSensitiveObjectName($possibleObjectName);
        return $controllerObjectName !== false ? $controllerObjectName : '';
    }

Usage Example

 /**
  * @test
  */
 public function getControllerObjectNameReturnsAnEmptyStringIfTheResolvedControllerDoesNotExist()
 {
     $mockObjectManager = $this->createMock(ObjectManagerInterface::class);
     $mockObjectManager->expects($this->at(0))->method('getCaseSensitiveObjectName')->with('SomePackage\\Some\\Subpackage\\Controller\\SomeControllerController')->will($this->returnValue(false));
     $mockPackageManager = $this->createMock(PackageManager::class);
     $mockPackageManager->expects($this->any())->method('getCaseSensitivePackageKey')->with('somepackage')->will($this->returnValue('SomePackage'));
     $this->inject($this->actionRequest, 'objectManager', $mockObjectManager);
     $this->inject($this->actionRequest, 'packageManager', $mockPackageManager);
     $this->actionRequest->setControllerPackageKey('somepackage');
     $this->actionRequest->setControllerSubPackageKey('Some\\Subpackage');
     $this->actionRequest->setControllerName('SomeController');
     $this->assertEquals('', $this->actionRequest->getControllerObjectName());
 }