RequestTicketResponse   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A fromCommand() 0 6 2
1
<?php
2
namespace FloSports\ScaleEngine\Response;
3
4
use FloSports\ScaleEngine\Model\Factory\ScaleEngineTicketFactory;
5
use Guzzle\Service\Command\OperationCommand;
6
7
/**
8
 * Provides the ability to convert a command response into a ScaleEngineTicket
9
 * model.
10
 */
11
class RequestTicketResponse extends AbstractScaleEngineResponse
12
{
13
    /**
14
     * Get the response from the command as a ScaleEngineTicket model.
15
     *
16
     * This takes the command given, ensures that it has a successful response,
17
     * and converts the response into a ScaleEngineTicket model.
18
     *
19
     * @param OperationCommand $command The RequestTicket API call made.
20
     * @param ScaleEngineTicketFactory $modelFactory The factory to use to
21
     *     create tickets.  Will be created if not given.
22
     * @return ScaleEngineTicket The ticket returned from the API request.
23
     */
24
    public static function fromCommand(OperationCommand $command, ScaleEngineTicketFactory $modelFactory = null)
25
    {
26
        $modelFactory = $modelFactory ?: new ScaleEngineTicketFactory();
27
28
        return $modelFactory->create(self::getResult($command, 'ticket'));
29
    }
30
}
31