Completed
Push — master ( 80ccd1...62dba4 )
by Neomerx
03:28
created
sample/Application.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
      */
59 59
     private function showSingleValueValidation(): void
60 60
     {
61
-        $this->console('Basic usage sample.' . PHP_EOL);
62
-        $this->console('===================' . PHP_EOL);
61
+        $this->console('Basic usage sample.'.PHP_EOL);
62
+        $this->console('==================='.PHP_EOL);
63 63
 
64 64
         // Let's build a rule that validates an input to be either `null` or a string from 5 to 10 characters.
65 65
         $validator = v::validator(
@@ -69,21 +69,21 @@  discard block
 block discarded – undo
69 69
         // let's try validation with valid input
70 70
         $input = null;
71 71
         if ($validator->validate($input) === true) {
72
-            $this->console("Validation OK for `null`." . PHP_EOL);
72
+            $this->console("Validation OK for `null`.".PHP_EOL);
73 73
         } else {
74 74
             assert(false, 'We should not be here.');
75 75
         }
76 76
         // another one
77 77
         $input = 'Hello';
78 78
         if ($validator->validate($input) === true) {
79
-            $this->console("Validation OK for `$input`." . PHP_EOL);
79
+            $this->console("Validation OK for `$input`.".PHP_EOL);
80 80
         } else {
81 81
             assert(false, 'We should not be here.');
82 82
         }
83 83
         // this one should not pass the validation
84 84
         $input = 'This string is too long.';
85 85
         if ($validator->validate($input) === false) {
86
-            $this->console("Input `$input` has not passed validation." . PHP_EOL);
86
+            $this->console("Input `$input` has not passed validation.".PHP_EOL);
87 87
             $this->printErrors($validator->getErrors());
88 88
         } else {
89 89
             assert(false, 'We should not be here.');
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
             r::isString(r::stringToDateTime(DATE_ATOM, r::between($fromDate, $toDate)))
100 100
                 ->setName('my_date')->enableCapture()
101 101
         );
102
-        $input     = '2001-03-04T05:06:07+08:00';
102
+        $input = '2001-03-04T05:06:07+08:00';
103 103
         if ($validator->validate($input) === true) {
104
-            $this->console("Validation OK for `$input`." . PHP_EOL);
104
+            $this->console("Validation OK for `$input`.".PHP_EOL);
105 105
             $myDate = $validator->getCaptures()['my_date'];
106 106
             // note that captured date is already DateTime
107 107
             assert($myDate instanceof DateTimeInterface);
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
             assert(false, 'We should not be here.');
110 110
         }
111 111
 
112
-        $this->console(PHP_EOL . PHP_EOL . PHP_EOL);
112
+        $this->console(PHP_EOL.PHP_EOL.PHP_EOL);
113 113
 
114 114
         // The output would be
115 115
         // -------------------------------------------------------------------------------------------------------
@@ -128,8 +128,8 @@  discard block
 block discarded – undo
128 128
      */
129 129
     private function showArrayValuesValidation(): void
130 130
     {
131
-        $this->console('Advanced usage sample.' . PHP_EOL);
132
-        $this->console('===================' . PHP_EOL);
131
+        $this->console('Advanced usage sample.'.PHP_EOL);
132
+        $this->console('==================='.PHP_EOL);
133 133
 
134 134
         // Validation rules for input are
135 135
         // - `email` must be a string and a valid email value (as FILTER_VALIDATE_EMAIL describes)
@@ -150,10 +150,10 @@  discard block
 block discarded – undo
150 150
             'last_name'    => '',
151 151
             'payment_plan' => '123',
152 152
         ];
153
-        $this->console('Invalid data (errors)' . PHP_EOL);
153
+        $this->console('Invalid data (errors)'.PHP_EOL);
154 154
         $validator->validate($invalidInput);
155 155
         $this->printErrors($validator->getErrors());
156
-        $this->console('Invalid data (captures)' . PHP_EOL);
156
+        $this->console('Invalid data (captures)'.PHP_EOL);
157 157
         $this->printCaptures($validator->getCaptures());
158 158
 
159 159
         // Check with valid data
@@ -163,10 +163,10 @@  discard block
 block discarded – undo
163 163
             'last_name'    => null,
164 164
             'payment_plan' => '2',
165 165
         ];
166
-        $this->console(PHP_EOL . 'Valid data (errors)' . PHP_EOL);
166
+        $this->console(PHP_EOL.'Valid data (errors)'.PHP_EOL);
167 167
         $validator->validate($validInput);
168 168
         $this->printErrors($validator->getErrors());
169
-        $this->console('Valid data (captures)' . PHP_EOL);
169
+        $this->console('Valid data (captures)'.PHP_EOL);
170 170
         $this->printCaptures($validator->getCaptures());
171 171
 
172 172
         // The output would be
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
         }
207 207
 
208 208
         if ($hasErrors === false) {
209
-            $this->console('No errors' . PHP_EOL);
209
+            $this->console('No errors'.PHP_EOL);
210 210
         }
211 211
     }
212 212
 
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
         $context    = $error->getMessageContext();
225 225
         $errorMsg   = MessageFormatter::formatMessage('en', $errorMsg, $context !== null ? $context : []);
226 226
 
227
-        $this->console("$entry failed for `$paramValue` with: $errorMsg" . PHP_EOL);
227
+        $this->console("$entry failed for `$paramValue` with: $errorMsg".PHP_EOL);
228 228
     }
229 229
 
230 230
     /**
@@ -239,11 +239,11 @@  discard block
 block discarded – undo
239 239
         foreach ($captures as $name => $value) {
240 240
             $hasCaptures = true;
241 241
             $type        = gettype($value);
242
-            $this->console("`$name` = `$value` ($type)" . PHP_EOL);
242
+            $this->console("`$name` = `$value` ($type)".PHP_EOL);
243 243
         }
244 244
 
245 245
         if ($hasCaptures === false) {
246
-            $this->console('No captures' . PHP_EOL);
246
+            $this->console('No captures'.PHP_EOL);
247 247
         }
248 248
     }
249 249
 
Please login to merge, or discard this patch.