Completed
Push — master ( 092247...6dd5e4 )
by Stéphane
06:20 queued 03:28
created

Put   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 50%

Importance

Changes 5
Bugs 1 Features 0
Metric Value
wmc 3
c 5
b 1
f 0
lcom 0
cbo 2
dl 0
loc 20
ccs 4
cts 8
cp 0.5
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __destruct() 0 6 2
A prepare() 0 5 1
1
<?php
2
/**
3
 * This file is part of the bee4/transport package.
4
 * For the full copyright and license information, please view the LICENSE
5
 * file that was distributed with this source code.
6
 *
7
 * @copyright Bee4 2015
8
 * @author  Stephane HULARD <[email protected]>
9
 * @package Bee4\Transport\Message\Request\Http
10
 */
11
12
namespace Bee4\Transport\Message\Request\Http;
13
14
use Bee4\Transport\Message\WithBodyStreamTrait;
15
16
/**
17
 * HTTP POST Request object
18
 * @package Bee4\Transport\Message\Request\Http
19
 */
20
class Put extends HttpRequest
21
{
22
    use WithBodyStreamTrait;
23
24 2
    protected function prepare()
25
    {
26 2
        $this->addOption('method', 'PUT');
27 2
        $this->addOption('body', $this->getBody());
28 2
    }
29
30
    /**
31
     * Handle resource management
32
     */
33
    public function __destruct()
34
    {
35
        if ($this->hasBodyStream()) {
36
            fclose($this->getBody());
37
        }
38
    }
39
}
40