@@ -27,73 +27,73 @@ discard block |
||
27 | 27 | */ |
28 | 28 | class OperationResult |
29 | 29 | { |
30 | - /** |
|
31 | - * @var string |
|
32 | - */ |
|
30 | + /** |
|
31 | + * @var string |
|
32 | + */ |
|
33 | 33 | protected $message = ''; |
34 | 34 | |
35 | - /** |
|
36 | - * @var bool |
|
37 | - */ |
|
35 | + /** |
|
36 | + * @var bool |
|
37 | + */ |
|
38 | 38 | protected $valid = true; |
39 | 39 | |
40 | - /** |
|
41 | - * @var object |
|
42 | - */ |
|
40 | + /** |
|
41 | + * @var object |
|
42 | + */ |
|
43 | 43 | protected $subject; |
44 | 44 | |
45 | - /** |
|
46 | - * @var integer |
|
47 | - */ |
|
45 | + /** |
|
46 | + * @var integer |
|
47 | + */ |
|
48 | 48 | protected $code = 0; |
49 | 49 | |
50 | - /** |
|
51 | - * The subject being validated. |
|
52 | - * |
|
53 | - * @param object $subject |
|
54 | - */ |
|
50 | + /** |
|
51 | + * The subject being validated. |
|
52 | + * |
|
53 | + * @param object $subject |
|
54 | + */ |
|
55 | 55 | public function __construct(object $subject) |
56 | 56 | { |
57 | 57 | $this->subject = $subject; |
58 | 58 | } |
59 | 59 | |
60 | - /** |
|
61 | - * Whether the validation was successful. |
|
62 | - * |
|
63 | - * @return bool |
|
64 | - */ |
|
60 | + /** |
|
61 | + * Whether the validation was successful. |
|
62 | + * |
|
63 | + * @return bool |
|
64 | + */ |
|
65 | 65 | public function isValid() : bool |
66 | 66 | { |
67 | 67 | return $this->valid; |
68 | 68 | } |
69 | 69 | |
70 | - /** |
|
71 | - * Retrieves the subject that was validated. |
|
72 | - * |
|
73 | - * @return object |
|
74 | - */ |
|
70 | + /** |
|
71 | + * Retrieves the subject that was validated. |
|
72 | + * |
|
73 | + * @return object |
|
74 | + */ |
|
75 | 75 | public function getSubject() : object |
76 | 76 | { |
77 | 77 | return $this->subject; |
78 | 78 | } |
79 | 79 | |
80 | - /** |
|
81 | - * Makes the result a succes, with the specified message. |
|
82 | - * |
|
83 | - * @param string $message Should not contain a date, just the system specific info. |
|
84 | - * @return OperationResult |
|
85 | - */ |
|
80 | + /** |
|
81 | + * Makes the result a succes, with the specified message. |
|
82 | + * |
|
83 | + * @param string $message Should not contain a date, just the system specific info. |
|
84 | + * @return OperationResult |
|
85 | + */ |
|
86 | 86 | public function makeSuccess(string $message, int $code=0) : OperationResult |
87 | 87 | { |
88 | 88 | return $this->setMessage($message, $code, true); |
89 | 89 | } |
90 | 90 | |
91 | - /** |
|
92 | - * Sets the result as an error. |
|
93 | - * |
|
94 | - * @param string $message Should be as detailed as possible. |
|
95 | - * @return OperationResult |
|
96 | - */ |
|
91 | + /** |
|
92 | + * Sets the result as an error. |
|
93 | + * |
|
94 | + * @param string $message Should be as detailed as possible. |
|
95 | + * @return OperationResult |
|
96 | + */ |
|
97 | 97 | public function makeError(string $message, int $code=0) : OperationResult |
98 | 98 | { |
99 | 99 | return $this->setMessage($message, $code, false); |
@@ -108,21 +108,21 @@ discard block |
||
108 | 108 | return $this; |
109 | 109 | } |
110 | 110 | |
111 | - /** |
|
112 | - * Retrieves the error message, if an error occurred. |
|
113 | - * |
|
114 | - * @return string The error message, or an empty string if no error occurred. |
|
115 | - */ |
|
111 | + /** |
|
112 | + * Retrieves the error message, if an error occurred. |
|
113 | + * |
|
114 | + * @return string The error message, or an empty string if no error occurred. |
|
115 | + */ |
|
116 | 116 | public function getErrorMessage() : string |
117 | 117 | { |
118 | 118 | return $this->getMessage(false); |
119 | 119 | } |
120 | 120 | |
121 | - /** |
|
122 | - * Retrieves the success message, if one has been provided. |
|
123 | - * |
|
124 | - * @return string |
|
125 | - */ |
|
121 | + /** |
|
122 | + * Retrieves the success message, if one has been provided. |
|
123 | + * |
|
124 | + * @return string |
|
125 | + */ |
|
126 | 126 | public function getSuccessMessage() : string |
127 | 127 | { |
128 | 128 | return $this->getMessage(true); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * @param string $message Should not contain a date, just the system specific info. |
84 | 84 | * @return OperationResult |
85 | 85 | */ |
86 | - public function makeSuccess(string $message, int $code=0) : OperationResult |
|
86 | + public function makeSuccess(string $message, int $code = 0) : OperationResult |
|
87 | 87 | { |
88 | 88 | return $this->setMessage($message, $code, true); |
89 | 89 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * @param string $message Should be as detailed as possible. |
95 | 95 | * @return OperationResult |
96 | 96 | */ |
97 | - public function makeError(string $message, int $code=0) : OperationResult |
|
97 | + public function makeError(string $message, int $code = 0) : OperationResult |
|
98 | 98 | { |
99 | 99 | return $this->setMessage($message, $code, false); |
100 | 100 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | |
141 | 141 | protected function getMessage(bool $valid) : string |
142 | 142 | { |
143 | - if($this->valid === $valid) |
|
143 | + if ($this->valid === $valid) |
|
144 | 144 | { |
145 | 145 | return $this->message; |
146 | 146 | } |