Completed
Pull Request — develop (#27)
by Chris
05:29
created

Resolution::getHeight()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Chrisyue\PhpM3u8\Value\Attribute;
4
5
class Resolution
6
{
7
    private $width;
8
9
    private $height;
10
11
    public function __construct(int $width, int $height)
12
    {
13
        $this->width = $width;
14
        $this->height = $height;
15
    }
16
17
    public static function fromString(string $string)
18
    {
19
        [$width, $height] = explode('x', $string);
0 ignored issues
show
Bug introduced by
The variable $width does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
Bug introduced by
The variable $height does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
20
21
        return new self($width, $height);
22
    }
23
24
    public function getWidth()
25
    {
26
        return $this->width;
27
    }
28
29
    public function getHeight()
30
    {
31
        return $this->height;
32
    }
33
34
    public function __toString()
35
    {
36
        return sprintf('%dx%d', $this->width, $this->height);
37
    }
38
}
39