ViewResult::execute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 2
b 0
f 0
nc 1
nop 0
dl 0
loc 11
rs 10
1
<?php
2
3
namespace Tkotosz\CommandScheduler\Controller\Adminhtml\Schedule;
4
5
use Magento\Framework\App\ObjectManager;
6
use Magento\Framework\App\Response\Http;
7
use Magento\Framework\App\ResponseInterface;
8
use Tkotosz\CommandScheduler\Api\CommandScheduleRepositoryInterface;
9
use Tkotosz\CommandScheduler\Controller\Adminhtml\Schedule;
10
11
class ViewResult extends Schedule
12
{
13
    /**
14
     * Execute action based on request and return result
15
     *
16
     * @return ResponseInterface
17
     */
18
    public function execute()
19
    {
20
        /** @var Http $response */
21
        $response = $this->getResponse();
22
        $repo = ObjectManager::getInstance()->get(CommandScheduleRepositoryInterface::class);
23
24
        $thing = $repo->getById($this->getRequest()->getParam('id'));
25
26
        $response->setBody(nl2br($thing->getResult()));
27
28
        return $this->getResponse();
29
    }
30
}
31
32