Code Duplication    Length = 38-39 lines in 2 locations

src/Offer/Commands/AbstractCommand.php 1 location

@@ 7-44 (lines=38) @@
4
5
use CultuurNet\UDB3\Role\ValueObjects\Permission;
6
7
abstract class AbstractCommand implements AuthorizableCommandInterface
8
{
9
    /**
10
     * @var string
11
     */
12
    protected $itemId;
13
14
    /**
15
     * AbstractCommand constructor.
16
     * @param string $itemId
17
     */
18
    public function __construct($itemId)
19
    {
20
        if (!is_string($itemId)) {
21
            throw new \InvalidArgumentException(
22
                'Expected itemId to be a string, received ' . gettype($itemId)
23
            );
24
        }
25
26
        $this->itemId = $itemId;
27
    }
28
29
    /**
30
     * @return string
31
     */
32
    public function getItemId()
33
    {
34
        return $this->itemId;
35
    }
36
37
    /**
38
     * @return Permission
39
     */
40
    public function getPermission()
41
    {
42
        return Permission::AANBOD_BEWERKEN();
43
    }
44
}
45

src/Event/Commands/Conclude.php 1 location

@@ 8-46 (lines=39) @@
5
use CultuurNet\UDB3\Offer\Commands\AuthorizableCommandInterface;
6
use CultuurNet\UDB3\Role\ValueObjects\Permission;
7
8
class Conclude implements AuthorizableCommandInterface
9
{
10
    /**
11
     * @var string
12
     */
13
    protected $itemId;
14
15
    /**
16
     * Conclude constructor.
17
     *
18
     * @param string $itemId
19
     */
20
    public function __construct($itemId)
21
    {
22
        if (!is_string($itemId)) {
23
            throw new \InvalidArgumentException(
24
                'Expected itemId to be a string, received ' . gettype($itemId)
25
            );
26
        }
27
28
        $this->itemId = $itemId;
29
    }
30
31
    /**
32
     * @return string
33
     */
34
    public function getItemId()
35
    {
36
        return $this->itemId;
37
    }
38
39
    /**
40
     * @return Permission
41
     */
42
    public function getPermission()
43
    {
44
        return  Permission::AANBOD_MODEREREN();
45
    }
46
}
47