Test Failed
Push — master ( 5ac70c...feabcf )
by Dan
02:34
created

Font::getPaddingAngle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace SixtyNine\Cloud\Model;
4
5
/**
6
 * Embed a TTF font in the Cloud system.
7
 */
8
class Font
9
{
10
    /** @var string */
11
    protected $name;
12
13
    /** @var string */
14
    protected $file;
15
16
    /**
17
     * Create a TTF font from the given $file.
18
     * @param string $name
19
     * @param string $file
20
     * @param int $paddingAngle
21
     * @param int $paddingSize
22
     * @throws \InvalidArgumentException
23
     */
24
    function __construct($name, $file, $paddingAngle = 0, $paddingSize = 1)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
25
    {
26
        if (!file_exists($file)) {
27
            throw new \InvalidArgumentException("File not found $file");
28
        }
29
30 7
        $this->name = $name;
31
        $this->file = $file;
32 7
        $this->paddingAngle = $paddingAngle;
0 ignored issues
show
Bug introduced by
The property paddingAngle does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
33
        $this->paddingSize = $paddingSize;
0 ignored issues
show
Bug introduced by
The property paddingSize does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
34
    }
35
36 7
    /**
37 7
     * @param string $file
38 7
     */
39 7
    public function setFile($file)
40 7
    {
41
        $this->file = $file;
42
    }
43
44
    /**
45
     * @return string
46
     */
47
    public function getFile()
48
    {
49
        return $this->file;
50
    }
51
52
    /**
53 6
     * @param string $name
54
     */
55 6
    public function setName($name)
56
    {
57
        $this->name = $name;
58
    }
59
60
    /**
61
     * @return string
62
     */
63
    public function getName()
64
    {
65
        return $this->name;
66
    }
67
}
68