MessageResponse::fromCommand()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 10
ccs 7
cts 7
cp 1
rs 9.4285
cc 1
eloc 6
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Crummy\Phlack\Bridge\Guzzle\Response;
4
5
use Guzzle\Common\Collection;
6
use Guzzle\Service\Command\OperationCommand;
7
use Guzzle\Service\Command\ResponseClassInterface;
8
9
class MessageResponse extends Collection implements ResponseClassInterface
10
{
11
    /**
12
     * @see ResponseClassInterface
13
     */
14 1
    public static function fromCommand(OperationCommand $command)
15
    {
16 1
        $response = $command->getResponse();
17
18 1
        return new self([
19 1
            'status' => $response->getStatusCode(),
20 1
            'reason' => $response->getReasonPhrase(),
21 1
            'text'   => $response->getBody(true),
22 1
        ]);
23
    }
24
}
25