1 | <?php |
||
15 | class WriteOperation implements OperationInterface |
||
16 | { |
||
17 | /** |
||
18 | * Data to write |
||
19 | * |
||
20 | * @var string|array|\Traversable |
||
21 | */ |
||
22 | private $data; |
||
23 | |||
24 | /** |
||
25 | * Flag if this is an out-of-band writing |
||
26 | * |
||
27 | * @var bool |
||
28 | */ |
||
29 | private $isOutOfBand; |
||
30 | |||
31 | /** |
||
32 | * WriteOperation constructor. |
||
33 | * |
||
34 | * @param string|array|\Traversable $data Data to send |
||
35 | * @param bool $isOutOfBand Flag if this is an out-of-band writing |
||
36 | */ |
||
37 | 42 | public function __construct($data = null, $isOutOfBand = false) |
|
42 | |||
43 | /** |
||
44 | * Return flag if this is an out-of-band writing |
||
45 | * |
||
46 | * @return bool |
||
47 | */ |
||
48 | 13 | public function isOutOfBand() |
|
52 | |||
53 | /** |
||
54 | * Set out-of-band flag |
||
55 | * |
||
56 | * @param bool $isOutOfBand Flag if this is an out-of-band writing |
||
57 | * |
||
58 | * @return void |
||
59 | */ |
||
60 | 1 | public function setOutOfBand($isOutOfBand) |
|
64 | |||
65 | /** {@inheritdoc} */ |
||
66 | 67 | public function getTypes() |
|
67 | { |
||
68 | 67 | return [self::OPERATION_WRITE]; |
|
69 | } |
||
70 | |||
71 | /** |
||
72 | * Return Data |
||
73 | * |
||
74 | * @return string|array|\Traversable |
||
75 | */ |
||
76 | 37 | public function getData() |
|
80 | |||
81 | /** |
||
82 | * Sets Data |
||
83 | * |
||
84 | * @param string|array|\Traversable $data Data to send |
||
85 | * |
||
86 | * @return void |
||
87 | */ |
||
88 | 29 | public function setData($data) |
|
92 | |||
93 | /** |
||
94 | * Checks whether request has data |
||
95 | * |
||
96 | * @return bool |
||
97 | */ |
||
98 | 5 | public function hasData() |
|
102 | |||
103 | /** |
||
104 | * Clear send data |
||
105 | * |
||
106 | * @return void |
||
107 | */ |
||
108 | 1 | public function clearData() |
|
112 | } |
||
113 |