Sulu\Component\Rest\Exception\RestException::toArray PHP Méthode

toArray() public méthode

public toArray ( )
    public function toArray()
    {
        return ['code' => $this->code, 'message' => $this->message];
    }

Usage Example

 public function testCGetActionWithUnexistingAlias()
 {
     $query = ['alias' => 'not_existent_alias'];
     $request = new Request($query);
     $contentNavigationAliasNotFoundException = new ContentNavigationAliasNotFoundException($query['alias'], []);
     $this->contentNavigationCollector->getNavigationItems(Argument::cetera())->willThrow($contentNavigationAliasNotFoundException);
     $exception = new RestException($contentNavigationAliasNotFoundException->getMessage(), 0, $contentNavigationAliasNotFoundException);
     $this->viewHandler->handle(View::create($exception->toArray(), 404))->shouldBeCalled();
     $this->contentNavigationController->cgetAction($request);
 }
All Usage Examples Of Sulu\Component\Rest\Exception\RestException::toArray
RestException