Mark V
1: <?php
2: namespace MOC\V\Component\Document\Component\Parameter\Repository;
3:
4: use MOC\V\Component\Document\Component\Exception\ComponentException;
5: use MOC\V\Component\Document\Component\IBridgeInterface;
6: use MOC\V\Component\Document\Component\IParameterInterface;
7: use MOC\V\Component\Document\Component\Parameter\Parameter;
8:
9: /**
10: * Class PaperOrientationParameter
11: *
12: * @package MOC\V\Component\Document\Component\Parameter\Repository
13: */
14: class PaperOrientationParameter extends Parameter implements IParameterInterface
15: {
16:
17: /** @var string $Orientation */
18: private $Orientation = null;
19:
20: /**
21: * @param string $Orientation
22: */
23: public function __construct($Orientation = 'PORTRAIT')
24: {
25:
26: $this->setOrientation($Orientation);
27: }
28:
29: /**
30: * @return string
31: */
32: public function __toString()
33: {
34:
35: return $this->getOrientation();
36: }
37:
38: /**
39: * @return string
40: */
41: public function getOrientation()
42: {
43:
44: return $this->Orientation;
45: }
46:
47: /**
48: * @param string $Orientation
49: *
50: * @return IBridgeInterface
51: * @throws ComponentException
52: */
53: public function setOrientation($Orientation)
54: {
55:
56: switch (strtoupper($Orientation)) {
57: case 'LANDSCAPE':
58: case 'PORTRAIT': {
59: $this->Orientation = $Orientation;
60: return $this;
61: }
62: default:
63: throw new ComponentException('Orientation '.$Orientation.' not supported');
64: }
65:
66: }
67: }
68: