Test Failed
Push — master ( b39eb7...589279 )
by Edgar
03:49
created

TransformTrait   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 104
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 13.03%

Importance

Changes 0
Metric Value
wmc 10
lcom 1
cbo 0
dl 0
loc 104
ccs 3
cts 23
cp 0.1303
rs 10
c 0
b 0
f 0

10 Methods

Rating   Name   Duplication   Size   Complexity  
A result() 0 4 1
A setArgumentDelimiter() 0 4 1
A rotate() 0 6 1
A translate() 0 6 1
A scale() 0 6 1
A skewX() 0 6 1
A skewY() 0 6 1
A matrix() 0 6 1
A compact() 0 6 1
A toMatrix() 0 6 1
1
<?php
2
namespace nstdio\svg\traits;
3
4
5
use nstdio\svg\util\transform\TransformInterface;
6
7
trait TransformTrait
8
{
9
    /**
10
     * @var TransformInterface
11
     */
12
    protected $transformImpl;
13
14
    /**
15
     * @inheritdoc
16
     */
17
    public function result()
18
    {
19
        return $this->transformImpl->result();
20
    }
21
22
    /**
23
     * @inheritdoc
24
     */
25
    public function setArgumentDelimiter($delim)
26
    {
27
        $this->transformImpl->setArgumentDelimiter($delim);
28
    }
29
30
    /**
31
     * @inheritdoc
32
     * @param int $angle
33
     */
34 4
    public function rotate($angle, $cx = null, $cy = null)
35
    {
36 4
        $this->setTransformAttribute($this->transformImpl->rotate($angle, $cx, $cy));
0 ignored issues
show
Bug introduced by
It seems like setTransformAttribute() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
37
38 4
        return $this;
39
    }
40
41
    /**
42
     * @inheritdoc
43
     */
44
    public function translate($x, $y = null)
45
    {
46
        $this->setTransformAttribute($this->transformImpl->translate($x, $y));
0 ignored issues
show
Bug introduced by
It seems like setTransformAttribute() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
47
48
        return $this;
49
    }
50
51
    /**
52
     * @inheritdoc
53
     */
54
    public function scale($x, $y = null)
55
    {
56
        $this->setTransformAttribute($this->transformImpl->scale($x, $y));
0 ignored issues
show
Bug introduced by
It seems like setTransformAttribute() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
57
58
        return $this;
59
    }
60
61
    /**
62
     * @inheritdoc
63
     */
64
    public function skewX($x)
65
    {
66
        $this->setTransformAttribute($this->transformImpl->skewX($x));
0 ignored issues
show
Bug introduced by
It seems like setTransformAttribute() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
67
68
        return $this;
69
    }
70
71
    /**
72
     * @inheritdoc
73
     */
74
    public function skewY($y)
75
    {
76
        $this->setTransformAttribute($this->transformImpl->skewY($y));
0 ignored issues
show
Bug introduced by
It seems like setTransformAttribute() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
77
78
        return $this;
79
    }
80
81
    /**
82
     * @inheritdoc
83
     */
84
    public function matrix(array $matrix)
85
    {
86
        $this->setTransformAttribute($this->transformImpl->matrix($matrix));
0 ignored issues
show
Bug introduced by
It seems like setTransformAttribute() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
87
88
        return $this;
89
    }
90
91
    /**
92
     * @inheritdoc
93
     */
94
    public function compact()
95
    {
96
        $this->setTransformAttribute($this->transformImpl->compact());
0 ignored issues
show
Bug introduced by
It seems like setTransformAttribute() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
97
98
        return $this;
99
    }
100
101
    /**
102
     * @inheritdoc
103
     */
104
    public function toMatrix()
105
    {
106
        $this->setTransformAttribute($this->transformImpl->toMatrix());
0 ignored issues
show
Bug introduced by
It seems like setTransformAttribute() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
107
108
        return $this;
109
    }
110
}