@@ 10-39 (lines=30) @@ | ||
7 | /** |
|
8 | * @api |
|
9 | */ |
|
10 | final class NewCommand implements Command |
|
11 | { |
|
12 | /** |
|
13 | * @var mixed |
|
14 | */ |
|
15 | private $entity; |
|
16 | ||
17 | /** |
|
18 | * @param mixed $entity |
|
19 | * @throws InvalidArgumentException |
|
20 | */ |
|
21 | public function __construct($entity) |
|
22 | { |
|
23 | if (!is_object($entity)) { |
|
24 | throw new InvalidArgumentException(sprintf("New command require object \"%s\" type passed.", gettype($entity))); |
|
25 | } |
|
26 | ||
27 | $this->entity = $entity; |
|
28 | } |
|
29 | ||
30 | /** |
|
31 | * @return mixed |
|
32 | * |
|
33 | * @api |
|
34 | */ |
|
35 | public function getEntity() |
|
36 | { |
|
37 | return $this->entity; |
|
38 | } |
|
39 | } |
|
40 |
@@ 10-39 (lines=30) @@ | ||
7 | /** |
|
8 | * @api |
|
9 | */ |
|
10 | final class RemoveCommand implements Command |
|
11 | { |
|
12 | /** |
|
13 | * @var mixed |
|
14 | */ |
|
15 | private $entity; |
|
16 | ||
17 | /** |
|
18 | * @param mixed $entity |
|
19 | * @throws InvalidArgumentException |
|
20 | */ |
|
21 | public function __construct($entity) |
|
22 | { |
|
23 | if (!is_object($entity)) { |
|
24 | throw new InvalidArgumentException(sprintf("Remove command require object \"%s\" type passed.", gettype($entity))); |
|
25 | } |
|
26 | ||
27 | $this->entity = $entity; |
|
28 | } |
|
29 | ||
30 | /** |
|
31 | * @return mixed |
|
32 | * |
|
33 | * @api |
|
34 | */ |
|
35 | public function getEntity() |
|
36 | { |
|
37 | return $this->entity; |
|
38 | } |
|
39 | } |
|
40 |