This class seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate
the same code in three or more different places, we strongly encourage you to
look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
12
{
13
/**
14
* Action parameter
15
*
16
* @const ACTION
17
*/
18
const ACTION = 'rebuild';
19
20
/**
21
* Action HTTP Method
22
*
23
* @const method
24
*/
25
const METHOD = 'POST';
26
27
/**
28
* Image slug or ID
29
*
30
* @var mixed image
31
*/
32
protected $image;
33
34
/**
35
* Constructor for rebuild action
36
*
37
* @param Array values
38
* @throws \InvalidArgumentException
39
*/
40
7
public function __construct(Array $values)
41
{
42
7
if (!isset($values['image'])) {
43
4
throw new InvalidArgumentException('Required value "image" is not present');
44
}
45
46
3
if (!is_numeric($values['image']) && !is_string($values['image'])) {
47
throw new InvalidArgumentException("Image argument must be a slug or ID");
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.