GetTicketStatusResponse::fromCommand()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 2
eloc 3
nc 2
nop 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 GetTicketStatusResponse 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 GetTicketStatus 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));
29
    }
30
}
31