32 self::TYPE_JSON => Result\Json::class,
33 self::TYPE_RAW => Result\Raw::class,
34 self::TYPE_REDIRECT => Result\Redirect::class,
35 self::TYPE_FORWARD => Result\Forward::class,
36 self::TYPE_LAYOUT => \Magento\Framework\View\Result\Layout::class,
37 self::TYPE_PAGE => \Magento\Framework\View\Result\Page::class,
43 private $objectManager;
68 if (isset($typeInfo[
'type']) && isset($typeInfo[
'class'])) {
69 $this->typeMap[$typeInfo[
'type']] = $typeInfo[
'class'];
84 if (empty($this->typeMap[
$type])) {
85 throw new \InvalidArgumentException(
'"' .
$type .
': isn\'t allowed');
88 $resultInstance = $this->objectManager->create($this->typeMap[
$type],
$arguments);
90 throw new \InvalidArgumentException(get_class($resultInstance) .
' isn\'t instance of ResultInterface');
99 if ($resultInstance instanceof \
Magento\Framework\View\Result\Layout) {
101 $resultInstance->addDefaultHandle();
104 return $resultInstance;
create($type, array $arguments=[])
mergeTypes(array $typeMap)
__construct(ObjectManagerInterface $objectManager, array $typeMap=[])