Completed
Pull Request — master (#122)
by
unknown
05:47
created

DropboxResponseToFile   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 36
ccs 0
cts 17
cp 0
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getBody() 0 4 1
A getFilePath() 0 4 1
A getSteamOrFilePath() 0 4 1
1
<?php
2
namespace Kunnu\Dropbox;
3
4
class DropboxResponseToFile extends DropboxResponse
5
{
6
    /**
7
     * @var DropboxFile
8
     */
9
    protected $file;
10
11
    /**
12
     * Create a new DropboxResponse instance
13
     *
14
     * @param DropboxRequest $request
15
     * @param DropboxFile $file
16
     * @param int|null    $httpStatusCode
17
     * @param array       $headers
18
     */
19
    public function __construct(DropboxRequest $request, DropboxFile $file, $httpStatusCode = null, array $headers = [])
20
    {
21
        parent::__construct($request, null, $httpStatusCode, $headers);
22
        $this->file = $file;
23
    }
24
25
    public function getBody()
26
    {
27
        return $this->file->getContents();
28
    }
29
30
    public function getFilePath()
31
    {
32
        return $this->file->getFilePath();
33
    }
34
35
    public function getSteamOrFilePath()
36
    {
37
        return $this->file->getStreamOrFilePath();
38
    }
39
}
40