LineAssetCommand::execute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 8
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 13
rs 10
1
<?php
2
3
namespace Jackal\ImageMerge\Command\Asset;
4
5
use Jackal\ImageMerge\Command\AbstractCommand;
6
use Jackal\ImageMerge\Command\Options\DoubleCoordinateColorCommandOption;
7
use Jackal\ImageMerge\Model\Image;
8
use Jackal\ImageMerge\Utils\ColorUtils;
9
10
/**
11
 * Class LineAssetCommand
12
 * @package Jackal\ImageMerge\Command\Asset
13
 */
14
class LineAssetCommand extends AbstractCommand
15
{
16
    /**
17
     * @param Image $image
18
     * @return Image
19
     */
20
    public function execute(Image $image)
21
    {
22
        /** @var DoubleCoordinateColorCommandOption $options */
23
        $options = $this->options;
24
        $color = ColorUtils::colorIdentifier($image->getResource(), $options->getColor());
25
        imageline($image->getResource(),
26
            $options->getCoordinate1()->getX(),
27
            $options->getCoordinate1()->getY(),
28
            $options->getCoordinate2()->getX(),
29
            $options->getCoordinate2()->getY(), $color
30
        );
31
32
        return $image;
33
    }
34
}
35