GetPriceHandler   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 15 2
1
<?php
2
declare(strict_types=1);
3
/**
4
 * Application Handler Class
5
 * @package Ticaje_BookingApi
6
 * @author  Hector Luis Barrientos <[email protected]>
7
 */
8
9
namespace Ticaje\BookingApi\Application\UseCase\Handler;
10
11
use Exception;
12
use Ticaje\Hexagonal\Application\Signatures\Responder\ResponseInterface;
13
use Ticaje\Hexagonal\Application\Signatures\UseCase\HandlerInterface;
14
use Ticaje\Hexagonal\Application\Signatures\UseCase\UseCaseCommandInterface;
15
16
/**
17
 * Class GetPriceHandler
18
 * @package Ticaje\BookingApi\Application\UseCase\Handler
19
 */
20
class GetPriceHandler extends AggregateBase implements HandlerInterface
21
{
22
    /**
23
     * @inheritDoc
24
     */
25
    public function handle(UseCaseCommandInterface $command): ResponseInterface
26
    {
27
        try {
28
            $this->responder
29
                ->setSuccess(true)
30
                ->setMessage('Prices fetched successfully!!!')
31
                ->setContent($this->launchLogic($command));
32
        } catch (Exception $exception) {
33
            $this->responder
34
                ->setSuccess(false)
35
                ->setMessage('There was a problem with price providing service!!! ')
36
                ->setContent(0);
37
        }
38
39
        return $this->responder;
40
    }
41
}
42