Completed
Push — feature/configuration ( 48ff2d...765854 )
by Stéphane
53:12 queued 25:50
created

Put::prepare()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 4
Bugs 1 Features 0
Metric Value
c 4
b 1
f 0
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
crap 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