Passed
Push — master ( c991d8...c23f05 )
by Sebastian
09:48
created
src/OperationResult.php 1 patch
Indentation   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -32,46 +32,46 @@  discard block
 block discarded – undo
32 32
     const TYPE_ERROR = 'error';
33 33
     const TYPE_SUCCESS = 'success';
34 34
     
35
-   /**
36
-    * @var string
37
-    */
35
+    /**
36
+     * @var string
37
+     */
38 38
     protected $message = '';
39 39
     
40
-   /**
41
-    * @var bool
42
-    */
40
+    /**
41
+     * @var bool
42
+     */
43 43
     protected $valid = true;
44 44
   
45
-   /**
46
-    * @var object
47
-    */
45
+    /**
46
+     * @var object
47
+     */
48 48
     protected $subject;
49 49
     
50
-   /**
51
-    * @var integer
52
-    */
50
+    /**
51
+     * @var integer
52
+     */
53 53
     protected $code = 0;
54 54
     
55
-   /**
56
-    * @var string
57
-    */
55
+    /**
56
+     * @var string
57
+     */
58 58
     protected $type = '';
59 59
     
60
-   /**
61
-    * @var integer
62
-    */
60
+    /**
61
+     * @var integer
62
+     */
63 63
     private static $counter = 0;
64 64
     
65
-   /**
66
-    * @var int
67
-    */
65
+    /**
66
+     * @var int
67
+     */
68 68
     private $id;
69 69
     
70
-   /**
71
-    * The subject being validated.
72
-    * 
73
-    * @param object $subject
74
-    */
70
+    /**
71
+     * The subject being validated.
72
+     * 
73
+     * @param object $subject
74
+     */
75 75
     public function __construct(object $subject)
76 76
     {
77 77
         $this->subject = $subject;
@@ -81,21 +81,21 @@  discard block
 block discarded – undo
81 81
         $this->id = self::$counter;
82 82
     }
83 83
     
84
-   /**
85
-    * Retrieves the ID of the result, which is unique within a request.
86
-    * 
87
-    * @return int
88
-    */
84
+    /**
85
+     * Retrieves the ID of the result, which is unique within a request.
86
+     * 
87
+     * @return int
88
+     */
89 89
     public function getID() : int
90 90
     {
91 91
         return $this->id;
92 92
     }
93 93
     
94
-   /**
95
-    * Whether the validation was successful.
96
-    * 
97
-    * @return bool
98
-    */
94
+    /**
95
+     * Whether the validation was successful.
96
+     * 
97
+     * @return bool
98
+     */
99 99
     public function isValid() : bool
100 100
     {
101 101
         return $this->valid;
@@ -126,33 +126,33 @@  discard block
 block discarded – undo
126 126
         return $this->type === $type;
127 127
     }
128 128
     
129
-   /**
130
-    * Retrieves the subject that was validated.
131
-    * 
132
-    * @return object
133
-    */
129
+    /**
130
+     * Retrieves the subject that was validated.
131
+     * 
132
+     * @return object
133
+     */
134 134
     public function getSubject() : object
135 135
     {
136 136
         return $this->subject;
137 137
     }
138 138
     
139
-   /**
140
-    * Makes the result a succes, with the specified message.
141
-    * 
142
-    * @param string $message Should not contain a date, just the system specific info.
143
-    * @return OperationResult
144
-    */
139
+    /**
140
+     * Makes the result a succes, with the specified message.
141
+     * 
142
+     * @param string $message Should not contain a date, just the system specific info.
143
+     * @return OperationResult
144
+     */
145 145
     public function makeSuccess(string $message, int $code=0) : OperationResult
146 146
     {
147 147
         return $this->setMessage(self::TYPE_SUCCESS, $message, $code, true);
148 148
     }
149 149
     
150
-   /**
151
-    * Sets the result as an error.
152
-    * 
153
-    * @param string $message Should be as detailed as possible.
154
-    * @return OperationResult
155
-    */
150
+    /**
151
+     * Sets the result as an error.
152
+     * 
153
+     * @param string $message Should be as detailed as possible.
154
+     * @return OperationResult
155
+     */
156 156
     public function makeError(string $message, int $code=0) : OperationResult
157 157
     {
158 158
         return $this->setMessage(self::TYPE_ERROR, $message, $code, false);
@@ -183,21 +183,21 @@  discard block
 block discarded – undo
183 183
         return $this->type;
184 184
     }
185 185
     
186
-   /**
187
-    * Retrieves the error message, if an error occurred.
188
-    * 
189
-    * @return string The error message, or an empty string if no error occurred.
190
-    */
186
+    /**
187
+     * Retrieves the error message, if an error occurred.
188
+     * 
189
+     * @return string The error message, or an empty string if no error occurred.
190
+     */
191 191
     public function getErrorMessage() : string
192 192
     {
193 193
         return $this->getMessage(self::TYPE_ERROR);
194 194
     }
195 195
     
196
-   /**
197
-    * Retrieves the success message, if one has been provided.
198
-    * 
199
-    * @return string
200
-    */
196
+    /**
197
+     * Retrieves the success message, if one has been provided.
198
+     * 
199
+     * @return string
200
+     */
201 201
     public function getSuccessMessage() : string
202 202
     {
203 203
         return $this->getMessage(self::TYPE_SUCCESS);
@@ -213,21 +213,21 @@  discard block
 block discarded – undo
213 213
         return $this->getMessage(self::TYPE_WARNING);
214 214
     }
215 215
     
216
-   /**
217
-    * Whether a specific error/success code has been specified.
218
-    * 
219
-    * @return bool
220
-    */
216
+    /**
217
+     * Whether a specific error/success code has been specified.
218
+     * 
219
+     * @return bool
220
+     */
221 221
     public function hasCode() : bool
222 222
     {
223 223
         return $this->code > 0;
224 224
     }
225 225
     
226
-   /**
227
-    * Retrieves the error/success code, if any. 
228
-    * 
229
-    * @return int The error code, or 0 if none.
230
-    */
226
+    /**
227
+     * Retrieves the error/success code, if any. 
228
+     * 
229
+     * @return int The error code, or 0 if none.
230
+     */
231 231
     public function getCode() : int
232 232
     {
233 233
         return $this->code;
Please login to merge, or discard this patch.
src/OperationResult/Collection.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -26,9 +26,9 @@  discard block
 block discarded – undo
26 26
  */
27 27
 class OperationResult_Collection extends OperationResult
28 28
 {
29
-   /**
30
-    * @var OperationResult[]
31
-    */
29
+    /**
30
+     * @var OperationResult[]
31
+     */
32 32
     protected $results = array();
33 33
     
34 34
     public function makeError(string $message, int $code=0) : OperationResult
@@ -106,9 +106,9 @@  discard block
 block discarded – undo
106 106
         return $this;
107 107
     }
108 108
     
109
-   /**
110
-    * @return OperationResult[]
111
-    */
109
+    /**
110
+     * @return OperationResult[]
111
+     */
112 112
     public function getResults() : array
113 113
     {
114 114
         return $this->results;
Please login to merge, or discard this patch.