Composite   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 23
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 1
A getName() 0 4 1
1
<?php
2
namespace nstdio\svg\filter;
3
use nstdio\svg\ElementInterface;
4
5
/**
6
 * Class Composite
7
 * This filter performs the combination of the two input images pixel-wise in image space using one of the Porter-Duff
8
 * compositing operations: over, in, atop, out, xor. Additionally, a component-wise
9
 * arithmetic operation (with the result clamped between [0..1]) can be applied.
10
 *
11
 * @link    https://www.w3.org/TR/SVG11/filters.html#feCompositeElement
12
 *
13
 * @property string operator = "over | in | out | atop | xor | arithmetic" The compositing operation that is to be
14
 *           performed. All of the 'operator' types except arithmetic match the corresponding operation as described in
15
 *           [PORTERDUFF]. The arithmetic operator is described above. If attribute 'operator' is not specified, then
16
 *           the effect is as if a value of over were specified.
17
 * @property float  k1       = "<number>" Only applicable if operator="arithmetic". If the attribute is not
18
 *           specified, the effect is as if a value of 0 were specified.
19
 * @property float  k2       = "<number>" Only applicable if operator="arithmetic". If the attribute is not
20
 *           specified, the effect is as if a value of 0 were specified.
21
 * @property float  k3       = "<number>" Only applicable if operator="arithmetic". If the attribute is not
22
 *           specified, the effect is as if a value of 0 were specified.
23
 * @property float  k4       = "<number>" Only applicable if operator="arithmetic". If the attribute is not
24
 *           specified, the effect is as if a value of 0 were specified.
25
 * @property string in2      = "(see 'in' attribute)" The second input image to the compositing operation. This
26
 *           attribute can take on the same values as the 'in' attribute.
27
 *
28
 * @package nstdio\svg\filter
29
 * @author  Edgar Asatryan <[email protected]>
30
 */
31
class Composite extends BaseFilter
32
{
33 3
    public function __construct(ElementInterface $parent)
34
    {
35 3
        parent::__construct($parent);
36 3
        $this->apply([
37 3
            'in' => 'SourceGraphic',
38 3
            'k1' => 0,
39 3
            'k2' => 0,
40 3
            'k3' => 0,
41 3
            'k4' => 0,
42 3
        ]);
43 3
    }
44
45
    /**
46
     * @inheritdoc
47
     */
48 3
    public function getName()
49
    {
50 3
        return "feComposite";
51
    }
52
53
}