Completed
Push — master ( 676136...b5d1cf )
by Mathieu
02:39
created

AbstractMaskEffect::setY()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 10
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 10
loc 10
rs 9.4285
cc 2
eloc 6
nc 2
nop 1
1
<?php
2
3
namespace Charcoal\Image\Effect;
4
5
use \InvalidArgumentException;
6
7
use \Charcoal\Image\AbstractEffect;
8
use \Charcoal\Image\Effect\LayerEffectInterface;
9
use \Charcoal\Image\Effect\LayerEffectTrait;
10
11
/**
12
 * Composite an opacity mask on top of the image
13
 */
14
abstract class AbstractMaskEffect extends AbstractEffect implements LayerEffectInterface
15
{
16
    use LayerEffectTrait;
17
18
    /**
19
     * The mask image source
20
     * @var string $mask
21
     */
22
    private $mask;
23
24
    /**
25
     * @param string $mask The mask image source.
26
     * @throws InvalidArgumentException If the mask source is not a string.
27
     * @return AbstractMaskEffect Chainable
28
     */
29
    public function setMask($mask)
30
    {
31
        if (!is_string($mask) || ($mask instanceof ImageInterface)) {
0 ignored issues
show
Bug introduced by
The class Charcoal\Image\Effect\ImageInterface does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
32
            throw new InvalidArgumentException(
33
                'Mask must be a string'
34
            );
35
        }
36
        $this->mask = $mask;
37
        return $this;
38
    }
39
40
    /**
41
     * @return string
42
     */
43
    public function mask()
44
    {
45
        return $this->mask;
46
    }
47
}
48