GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

FormByteRangeUpload   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 17
c 1
b 0
f 0
dl 0
loc 58
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getHeaders() 0 16 2
A __construct() 0 7 1
1
<?php
2
3
namespace ApiVideo\Client\Buzz;
4
5
use Buzz\Message\Form\FormUpload;
6
use Exception;
7
use RuntimeException;
8
9
class FormByteRangeUpload extends FormUpload
10
{
11
    /**
12
     *
13
     * @var int
14
     */
15
    private $from;
16
17
    /**
18
     *
19
     * @var int
20
     */
21
    private $to;
22
23
    /**
24
     *
25
     * @var int
26
     */
27
    private $length;
28
29
    /**
30
     *
31
     * @param string $file
32
     * @param int $from
33
     * @param int $to
34
     * @param int $length
35
     * @param string $contentType
36
     */
37
    public function __construct($file, $from, $to, $length = null, $contentType = null)
38
    {
39
        parent::__construct($file, $contentType);
40
41
        $this->from   = $from;
42
        $this->to     = $to;
43
        $this->length = $length;
44
    }
45
46
    /**
47
     *
48
     * @return array
49
     * @throws Exception
50
     */
51
    public function getHeaders()
52
    {
53
        $headers = parent::getHeaders();
54
55
        if (!$this->getFile()) {
56
            throw new RuntimeException('Missing file');
57
        }
58
59
        $headers[] = sprintf(
60
            'Content-Range: %d-%d/%d',
61
            $this->from,
62
            $this->to,
63
            $this->length
64
        );
65
66
        return $headers;
67
    }
68
}
69