Completed
Push — master ( ad34f0...67a90e )
by Stefano
32s
created

src/ResponseLocation/ReasonPhraseLocation.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
namespace GuzzleHttp\Command\Guzzle\ResponseLocation;
3
4
use GuzzleHttp\Command\Guzzle\Parameter;
5
use GuzzleHttp\Command\ResultInterface;
6
use Psr\Http\Message\ResponseInterface;
7
8
/**
9
 * Extracts the reason phrase of a response into a result field
10
 */
11 View Code Duplication
class ReasonPhraseLocation extends AbstractLocation
0 ignored issues
show
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
12
{
13
14
    /**
15
     * Set the name of the location
16
     *
17
     * @param string $locationName
18
     */
19 1
    public function __construct($locationName = 'reasonPhrase')
20
    {
21 1
        parent::__construct($locationName);
22 1
    }
23
24
    /**
25
     * @param ResultInterface $result
26
     * @param ResponseInterface $response
27
     * @param Parameter $param
28
     * @return ResultInterface
29
     */
30 1
    public function visit(
31
        ResultInterface $result,
32
        ResponseInterface $response,
33
        Parameter $param
34
    ) {
35 1
        $result[$param->getName()] = $param->filter(
36 1
            $response->getReasonPhrase()
37 1
        );
38
39 1
        return $result;
40
    }
41
}
42