Completed
Push — fix_travis_behat ( 3c7f1b...b1b900 )
by
unknown
54:25 queued 34:54
created

Request::__construct()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 28
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 16
nc 1
nop 1
dl 0
loc 28
rs 8.8571
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * File containing the Request class.
5
 *
6
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
7
 * @license For full copyright and license information view LICENSE file distributed with this source code.
8
 */
9
namespace eZ\Publish\Core\REST\Server;
10
11
use Qafoo\RMF\Request\HTTP as RMFRequest;
12
use Qafoo\RMF\Request\PropertyHandler;
13
14
/**
15
 * Encapsulated RMF HTTP Request for REST server.
16
 *
17
 * @todo Remove when the REST client is refactored
18
 */
19
class Request extends RMFRequest
20
{
21
    /**
22
     * Construct request from a set of handlers.
23
     *
24
     * @param array $handlers
25
     *
26
     * @return \eZ\Publish\Core\REST\Server\Request
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
27
     */
28
    public function __construct(array $handlers = array())
29
    {
30
        $this->addHandler('body', new PropertyHandler\RawBody());
31
32
        $this->addHandler(
33
            'contentType',
34
            new PropertyHandler\Override(
35
                array(
36
                    new PropertyHandler\Server('CONTENT_TYPE'),
37
                    new PropertyHandler\Server('HTTP_CONTENT_TYPE'),
38
                )
39
            )
40
        );
41
42
        $this->addHandler(
43
            'method',
44
            new PropertyHandler\Override(
45
                array(
46
                    new PropertyHandler\Server('HTTP_X_HTTP_METHOD_OVERRIDE'),
47
                    new PropertyHandler\Server('REQUEST_METHOD'),
48
                )
49
            )
50
        );
51
52
        $this->addHandler('destination', new PropertyHandler\Server('HTTP_DESTINATION'));
53
54
        parent::__construct($handlers);
55
    }
56
}
57