ViewResult   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 6
c 2
b 0
f 0
dl 0
loc 18
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A execute() 0 11 1
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