GetPickupLocationHandler::handle()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 15
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 11
nc 2
nop 1
dl 0
loc 15
rs 9.9
c 1
b 0
f 0
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 GetPickupLocationHandler
18
 * @package Ticaje\BookingApi\Application\UseCase\Handler
19
 */
20
class GetPickupLocationHandler 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