Completed
Pull Request — master (#19)
by
unknown
02:55
created
Instapago/Api.php 4 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -199,9 +199,9 @@
 block discarded – undo
199 199
    * Realiza Transaccion
200 200
    * Efectúa y retornar una respuesta a un metodo de pago.
201 201
    *
202
-   * @param $url endpoint a consultar
202
+   * @param string $url endpoint a consultar
203 203
    * @param $fields datos para la consulta
204
-   * @param $method verbo http de la consulta
204
+   * @param string $method verbo http de la consulta
205 205
    *
206 206
    * @return $obj array resultados de la transaccion
207 207
    */
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
    *                            Requeridas.
48 48
    */
49 49
   public function __construct($keyId, $publicKeyId) {
50
-    if ( empty($keyId) || empty($publicKeyId) ) {
50
+    if (empty($keyId) || empty($publicKeyId)) {
51 51
       throw new Exceptions\InstapagoException('Los parámetros "keyId" y "publicKeyId" son requeridos para procesar la petición.');
52 52
     }
53 53
     $this->publicKeyId = $publicKeyId;
@@ -94,9 +94,9 @@  discard block
 block discarded – undo
94 94
     $type = null;
95 95
     if ($paymentType == 'direct') {
96 96
       $type = '2';
97
-    }else if ($paymentType == 'reserve') {
97
+    } else if ($paymentType == 'reserve') {
98 98
       $type = '1';
99
-    }else{
99
+    } else {
100 100
       throw new Exceptions\InstapagoException("Invalid Payment type");
101 101
     }
102 102
 
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
    * @return \ArrayObject<string, string> Respuesta de Instapago
133 133
    * @throws Exceptions\InstapagoException
134 134
    */
135
-  public function continuePayment($fields){
135
+  public function continuePayment($fields) {
136 136
     $validator = (new Validator())->release()->validate($fields);
137 137
     $fields = [
138 138
       'KeyID'        => $this->keyId, //required
@@ -217,11 +217,11 @@  discard block
 block discarded – undo
217 217
       $args = [
218 218
         'query' => $fields
219 219
       ];
220
-    }else if ($method == 'POST' || $method == 'DELETE') {
220
+    } else if ($method == 'POST' || $method == 'DELETE') {
221 221
       $args = [
222 222
           'form_params' => $fields
223 223
       ];
224
-    }else{
224
+    } else {
225 225
       throw new Exception("Not implemented yet", 1);
226 226
     }
227 227
     
@@ -250,24 +250,24 @@  discard block
 block discarded – undo
250 250
       throw new Exceptions\InvalidInputException(
251 251
         'Error al validar los datos enviados.'
252 252
       );
253
-    }else if ($code == 401) {
253
+    } else if ($code == 401) {
254 254
       throw new Exceptions\AuthException(
255 255
         'Error de autenticación, ha ocurrido un error'
256 256
         . ' con las llaves utilizadas.');
257
-    }else if ($code == 403) {
257
+    } else if ($code == 403) {
258 258
       throw new Exceptions\BankRejectException(
259 259
         'Pago Rechazado por el banco.'
260 260
       );
261
-    }else if ($code == 500) {
261
+    } else if ($code == 500) {
262 262
       throw new Exceptions\InstapagoException(
263 263
         'Ha Ocurrido un error interno dentro del servidor.'
264 264
       );
265
-    }else if ($code == 503) {
265
+    } else if ($code == 503) {
266 266
       throw new Exceptions\InstapagoException(
267 267
         'Ha Ocurrido un error al procesar los parámetros de entrada.'
268 268
         . ' Revise los datos enviados y vuelva a intentarlo.'
269 269
       );
270
-    }else if ($code == 201) {
270
+    } else if ($code == 201) {
271 271
       return [
272 272
         'code'         => $code,
273 273
         'msg_banco'    => $obj->message,
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
         'id_pago'      => $obj->id,
276 276
         'reference'    => $obj->reference,
277 277
       ];
278
-    }else {
278
+    } else {
279 279
       throw new \Exception('Not implemented yet');
280 280
     }
281 281
   }
Please login to merge, or discard this patch.
Braces   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -94,9 +94,9 @@  discard block
 block discarded – undo
94 94
     $type = null;
95 95
     if ($paymentType == 'direct') {
96 96
       $type = '2';
97
-    }else if ($paymentType == 'reserve') {
97
+    } else if ($paymentType == 'reserve') {
98 98
       $type = '1';
99
-    }else{
99
+    } else{
100 100
       throw new Exceptions\InstapagoException("Invalid Payment type");
101 101
     }
102 102
 
@@ -217,11 +217,11 @@  discard block
 block discarded – undo
217 217
       $args = [
218 218
         'query' => $fields
219 219
       ];
220
-    }else if ($method == 'POST' || $method == 'DELETE') {
220
+    } else if ($method == 'POST' || $method == 'DELETE') {
221 221
       $args = [
222 222
           'form_params' => $fields
223 223
       ];
224
-    }else{
224
+    } else{
225 225
       throw new Exception("Not implemented yet", 1);
226 226
     }
227 227
     
@@ -250,24 +250,24 @@  discard block
 block discarded – undo
250 250
       throw new Exceptions\InvalidInputException(
251 251
         'Error al validar los datos enviados.'
252 252
       );
253
-    }else if ($code == 401) {
253
+    } else if ($code == 401) {
254 254
       throw new Exceptions\AuthException(
255 255
         'Error de autenticación, ha ocurrido un error'
256 256
         . ' con las llaves utilizadas.');
257
-    }else if ($code == 403) {
257
+    } else if ($code == 403) {
258 258
       throw new Exceptions\BankRejectException(
259 259
         'Pago Rechazado por el banco.'
260 260
       );
261
-    }else if ($code == 500) {
261
+    } else if ($code == 500) {
262 262
       throw new Exceptions\InstapagoException(
263 263
         'Ha Ocurrido un error interno dentro del servidor.'
264 264
       );
265
-    }else if ($code == 503) {
265
+    } else if ($code == 503) {
266 266
       throw new Exceptions\InstapagoException(
267 267
         'Ha Ocurrido un error al procesar los parámetros de entrada.'
268 268
         . ' Revise los datos enviados y vuelva a intentarlo.'
269 269
       );
270
-    }else if ($code == 201) {
270
+    } else if ($code == 201) {
271 271
       return [
272 272
         'code'         => $code,
273 273
         'msg_banco'    => $obj->message,
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
         'id_pago'      => $obj->id,
276 276
         'reference'    => $obj->reference,
277 277
       ];
278
-    }else {
278
+    } else {
279 279
       throw new \Exception('Not implemented yet');
280 280
     }
281 281
   }
Please login to merge, or discard this patch.
Indentation   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
    *                            Requeridas.
48 48
    */
49 49
   public function __construct($keyId, $publicKeyId) {
50
-    if ( empty($keyId) || empty($publicKeyId) ) {
51
-      throw new Exceptions\InstapagoException('Los parámetros "keyId" y "publicKeyId" son requeridos para procesar la petición.');
52
-    }
53
-    $this->publicKeyId = $publicKeyId;
54
-    $this->keyId = $keyId;
50
+	if ( empty($keyId) || empty($publicKeyId) ) {
51
+	  throw new Exceptions\InstapagoException('Los parámetros "keyId" y "publicKeyId" son requeridos para procesar la petición.');
52
+	}
53
+	$this->publicKeyId = $publicKeyId;
54
+	$this->keyId = $keyId;
55 55
   }
56 56
 
57 57
   /**
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
    */
65 65
   public function directPayment($fields)
66 66
   {
67
-    return $this->payment('direct', $fields);
67
+	return $this->payment('direct', $fields);
68 68
   }
69 69
 
70 70
   /**
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
    */
78 78
   public function reservePayment($fields)
79 79
   {
80
-    return $this->payment('reserve', $fields);
80
+	return $this->payment('reserve', $fields);
81 81
   }
82 82
 
83 83
   /**
@@ -91,35 +91,35 @@  discard block
 block discarded – undo
91 91
    */
92 92
 
93 93
   public function payment($paymentType, $fields) {
94
-    $type = null;
95
-    if ($paymentType == 'direct') {
96
-      $type = '2';
97
-    }else if ($paymentType == 'reserve') {
98
-      $type = '1';
99
-    }else{
100
-      throw new Exceptions\InstapagoException("Invalid Payment type");
101
-    }
94
+	$type = null;
95
+	if ($paymentType == 'direct') {
96
+	  $type = '2';
97
+	}else if ($paymentType == 'reserve') {
98
+	  $type = '1';
99
+	}else{
100
+	  throw new Exceptions\InstapagoException("Invalid Payment type");
101
+	}
102 102
 
103
-    (new Validator())->payment()->validate($fields);
103
+	(new Validator())->payment()->validate($fields);
104 104
 
105
-    $fields = [
106
-      'KeyID'          => $this->keyId, 
107
-      'PublicKeyId'    => $this->publicKeyId, 
108
-      'amount'         => $fields['amount'], 
109
-      'description'    => $fields['description'], 
110
-      'cardHolder'     => $fields['card_holder'], 
111
-      'cardHolderId'   => $fields['card_holder_id'], 
112
-      'cardNumber'     => $fields['card_number'], 
113
-      'cvc'            => $fields['cvc'], 
114
-      'expirationDate' => $fields['expiration'], 
115
-      'statusId'       => $type, 
116
-      'IP'             => $fields['ip'], 
117
-    ];
105
+	$fields = [
106
+	  'KeyID'          => $this->keyId, 
107
+	  'PublicKeyId'    => $this->publicKeyId, 
108
+	  'amount'         => $fields['amount'], 
109
+	  'description'    => $fields['description'], 
110
+	  'cardHolder'     => $fields['card_holder'], 
111
+	  'cardHolderId'   => $fields['card_holder_id'], 
112
+	  'cardNumber'     => $fields['card_number'], 
113
+	  'cvc'            => $fields['cvc'], 
114
+	  'expirationDate' => $fields['expiration'], 
115
+	  'statusId'       => $type, 
116
+	  'IP'             => $fields['ip'], 
117
+	];
118 118
 
119
-    $obj = $this->curlTransaccion('payment', $fields, 'POST');
120
-    $result = $this->checkResponseCode($obj);
119
+	$obj = $this->curlTransaccion('payment', $fields, 'POST');
120
+	$result = $this->checkResponseCode($obj);
121 121
 
122
-    return $result;
122
+	return $result;
123 123
   }
124 124
 
125 125
   /**
@@ -133,17 +133,17 @@  discard block
 block discarded – undo
133 133
    * @throws Exceptions\InstapagoException
134 134
    */
135 135
   public function continuePayment($fields){
136
-    (new Validator())->release()->validate($fields);
137
-    $fields = [
138
-      'KeyID'        => $this->keyId, //required
139
-      'PublicKeyId'  => $this->publicKeyId, //required
140
-      'id'           => $fields['id'], //required
141
-      'amount'       => $fields['amount'], //required
142
-    ];
136
+	(new Validator())->release()->validate($fields);
137
+	$fields = [
138
+	  'KeyID'        => $this->keyId, //required
139
+	  'PublicKeyId'  => $this->publicKeyId, //required
140
+	  'id'           => $fields['id'], //required
141
+	  'amount'       => $fields['amount'], //required
142
+	];
143 143
 
144
-    $obj = $this->curlTransaccion('complete', $fields, 'POST');
145
-    $result = $this->checkResponseCode($obj);
146
-    return $result;
144
+	$obj = $this->curlTransaccion('complete', $fields, 'POST');
145
+	$result = $this->checkResponseCode($obj);
146
+	return $result;
147 147
   }
148 148
 
149 149
   /**
@@ -156,19 +156,19 @@  discard block
 block discarded – undo
156 156
    * @throws Exceptions\InstapagoException
157 157
    */
158 158
   public function query($id_pago) {
159
-    (new Validator())->query()->validate([
160
-      'id' => $id_pago
161
-    ]);
159
+	(new Validator())->query()->validate([
160
+	  'id' => $id_pago
161
+	]);
162 162
 
163
-    $fields = [
164
-      'KeyID'        => $this->keyId, //required
165
-      'PublicKeyId'  => $this->publicKeyId, //required
166
-      'id'           => $id_pago, //required
167
-    ];
163
+	$fields = [
164
+	  'KeyID'        => $this->keyId, //required
165
+	  'PublicKeyId'  => $this->publicKeyId, //required
166
+	  'id'           => $id_pago, //required
167
+	];
168 168
 
169
-    $obj = $this->curlTransaccion('payment', $fields, 'GET');
170
-    $result = $this->checkResponseCode($obj);
171
-    return $result;
169
+	$obj = $this->curlTransaccion('payment', $fields, 'GET');
170
+	$result = $this->checkResponseCode($obj);
171
+	return $result;
172 172
   }
173 173
 
174 174
   /**
@@ -180,19 +180,19 @@  discard block
 block discarded – undo
180 180
    * @throws Exceptions\InstapagoException
181 181
    */
182 182
   public function cancel($id_pago) {
183
-    (new Validator())->query()->validate([
184
-      'id' => $id_pago
185
-    ]);
183
+	(new Validator())->query()->validate([
184
+	  'id' => $id_pago
185
+	]);
186 186
 
187
-    $fields = [
188
-      'KeyID'        => $this->keyId, //required
189
-      'PublicKeyId'  => $this->publicKeyId, //required
190
-      'id'           => $id_pago, //required
191
-    ];
187
+	$fields = [
188
+	  'KeyID'        => $this->keyId, //required
189
+	  'PublicKeyId'  => $this->publicKeyId, //required
190
+	  'id'           => $id_pago, //required
191
+	];
192 192
 
193
-    $obj = $this->curlTransaccion('payment', $fields, 'DELETE');
194
-    $result = $this->checkResponseCode($obj);
195
-    return $result;
193
+	$obj = $this->curlTransaccion('payment', $fields, 'DELETE');
194
+	$result = $this->checkResponseCode($obj);
195
+	return $result;
196 196
   }
197 197
 
198 198
   /**
@@ -207,32 +207,32 @@  discard block
 block discarded – undo
207 207
    */
208 208
   public function curlTransaccion($url, $fields, $method)
209 209
   {
210
-    $client = new Client([
211
-       'base_uri' => 'https://api.instapago.com/',
212
-    ]);
210
+	$client = new Client([
211
+	   'base_uri' => 'https://api.instapago.com/',
212
+	]);
213 213
 
214
-    $args = [];
214
+	$args = [];
215 215
     
216
-    if ($method == 'GET') {
217
-      $args = [
218
-        'query' => $fields
219
-      ];
220
-    }else if ($method == 'POST' || $method == 'DELETE') {
221
-      $args = [
222
-          'form_params' => $fields
223
-      ];
224
-    }else{
225
-      throw new Exception("Not implemented yet", 1);
226
-    }
216
+	if ($method == 'GET') {
217
+	  $args = [
218
+		'query' => $fields
219
+	  ];
220
+	}else if ($method == 'POST' || $method == 'DELETE') {
221
+	  $args = [
222
+		  'form_params' => $fields
223
+	  ];
224
+	}else{
225
+	  throw new Exception("Not implemented yet", 1);
226
+	}
227 227
     
228
-    try {
229
-      $request = $client->request($method, $url, $args);
230
-      $body = $request->getBody()->getContents();
231
-      $obj = json_decode($body);
232
-      return $obj;
233
-    } catch (\GuzzleHttp\Exception\ConnectException $e) {
234
-      throw new Exceptions\TimeoutException("Cannot connect to api.instapago.com");
235
-    }
228
+	try {
229
+	  $request = $client->request($method, $url, $args);
230
+	  $body = $request->getBody()->getContents();
231
+	  $obj = json_decode($body);
232
+	  return $obj;
233
+	} catch (\GuzzleHttp\Exception\ConnectException $e) {
234
+	  throw new Exceptions\TimeoutException("Cannot connect to api.instapago.com");
235
+	}
236 236
   }
237 237
 
238 238
   /**
@@ -244,40 +244,40 @@  discard block
 block discarded – undo
244 244
    */
245 245
   public function checkResponseCode($obj)
246 246
   {
247
-    $code = $obj->code;
247
+	$code = $obj->code;
248 248
 
249
-    if ($code == 400) {
250
-      throw new Exceptions\InvalidInputException(
251
-        'Error al validar los datos enviados.'
252
-      );
253
-    }else if ($code == 401) {
254
-      throw new Exceptions\AuthException(
255
-        'Error de autenticación, ha ocurrido un error'
256
-        . ' con las llaves utilizadas.');
257
-    }else if ($code == 403) {
258
-      throw new Exceptions\BankRejectException(
259
-        'Pago Rechazado por el banco.'
260
-      );
261
-    }else if ($code == 500) {
262
-      throw new Exceptions\InstapagoException(
263
-        'Ha Ocurrido un error interno dentro del servidor.'
264
-      );
265
-    }else if ($code == 503) {
266
-      throw new Exceptions\InstapagoException(
267
-        'Ha Ocurrido un error al procesar los parámetros de entrada.'
268
-        . ' Revise los datos enviados y vuelva a intentarlo.'
269
-      );
270
-    }else if ($code == 201) {
271
-      return [
272
-        'code'         => $code,
273
-        'msg_banco'    => $obj->message,
274
-        'voucher'      => html_entity_decode($obj->voucher),
275
-        'id_pago'      => $obj->id,
276
-        'reference'    => $obj->reference,
277
-      ];
278
-    }else {
279
-      throw new \Exception('Not implemented yet');
280
-    }
249
+	if ($code == 400) {
250
+	  throw new Exceptions\InvalidInputException(
251
+		'Error al validar los datos enviados.'
252
+	  );
253
+	}else if ($code == 401) {
254
+	  throw new Exceptions\AuthException(
255
+		'Error de autenticación, ha ocurrido un error'
256
+		. ' con las llaves utilizadas.');
257
+	}else if ($code == 403) {
258
+	  throw new Exceptions\BankRejectException(
259
+		'Pago Rechazado por el banco.'
260
+	  );
261
+	}else if ($code == 500) {
262
+	  throw new Exceptions\InstapagoException(
263
+		'Ha Ocurrido un error interno dentro del servidor.'
264
+	  );
265
+	}else if ($code == 503) {
266
+	  throw new Exceptions\InstapagoException(
267
+		'Ha Ocurrido un error al procesar los parámetros de entrada.'
268
+		. ' Revise los datos enviados y vuelva a intentarlo.'
269
+	  );
270
+	}else if ($code == 201) {
271
+	  return [
272
+		'code'         => $code,
273
+		'msg_banco'    => $obj->message,
274
+		'voucher'      => html_entity_decode($obj->voucher),
275
+		'id_pago'      => $obj->id,
276
+		'reference'    => $obj->reference,
277
+	  ];
278
+	}else {
279
+	  throw new \Exception('Not implemented yet');
280
+	}
281 281
   }
282 282
 
283 283
 }
Please login to merge, or discard this patch.
Instapago/Exceptions/InvalidInputException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,4 +31,4 @@
 block discarded – undo
31 31
 /**
32 32
  * Custom InvalidInputException.
33 33
  */
34
-class InvalidInputException extends \Exception{}
34
+class InvalidInputException extends \Exception {}
Please login to merge, or discard this patch.
Instapago/Exceptions/ValidationException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,4 +31,4 @@
 block discarded – undo
31 31
 /**
32 32
  * Custom ValidationException.
33 33
  */
34
-class ValidationException extends \Exception{}
34
+class ValidationException extends \Exception {}
Please login to merge, or discard this patch.
Instapago/Exceptions/BankRejectException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,4 +31,4 @@
 block discarded – undo
31 31
 /**
32 32
  * Custom BankRejectException.
33 33
  */
34
-class BankRejectException extends \Exception{}
34
+class BankRejectException extends \Exception {}
Please login to merge, or discard this patch.
Instapago/Exceptions/AuthException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,4 +31,4 @@
 block discarded – undo
31 31
 /**
32 32
  * Custom AuthException.
33 33
  */
34
-class AuthException extends \Exception{}
34
+class AuthException extends \Exception {}
Please login to merge, or discard this patch.
Instapago/Exceptions/TimeoutException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,4 +31,4 @@
 block discarded – undo
31 31
 /**
32 32
  * Custom TimeoutException.
33 33
  */
34
-class TimeoutException extends \Exception{}
34
+class TimeoutException extends \Exception {}
Please login to merge, or discard this patch.
Instapago/Exceptions/InstapagoException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,4 +31,4 @@
 block discarded – undo
31 31
 /**
32 32
  * Custom InstapagoException.
33 33
  */
34
-class InstapagoException extends \Exception{}
34
+class InstapagoException extends \Exception {}
Please login to merge, or discard this patch.
Instapago/Validator.php 2 patches
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -38,54 +38,54 @@
 block discarded – undo
38 38
   protected $validations = [];
39 39
 
40 40
   public function payment() {
41
-    $this->validations = [
42
-      'amount' => [FILTER_VALIDATE_FLOAT],
43
-      'description' => [FILTER_VALIDATE_REGEXP, '/^(.{0,140})$/'],
44
-      'card_holder' => [FILTER_VALIDATE_REGEXP, '/^([a-zA-Z\ ]+)$/'],
45
-      'card_holder_id' => [FILTER_VALIDATE_REGEXP, '/^(\d{5,8})$/'],
46
-      'card_number' => [FILTER_VALIDATE_REGEXP, '/^(\d{16})$/'],
47
-      'cvc' => [FILTER_VALIDATE_INT],
48
-      'expiration' => [FILTER_VALIDATE_REGEXP, '/^(\d{2})\/(\d{4})$/'],
49
-      'ip' => [FILTER_VALIDATE_IP],
50
-    ];
51
-    return $this;
41
+	$this->validations = [
42
+	  'amount' => [FILTER_VALIDATE_FLOAT],
43
+	  'description' => [FILTER_VALIDATE_REGEXP, '/^(.{0,140})$/'],
44
+	  'card_holder' => [FILTER_VALIDATE_REGEXP, '/^([a-zA-Z\ ]+)$/'],
45
+	  'card_holder_id' => [FILTER_VALIDATE_REGEXP, '/^(\d{5,8})$/'],
46
+	  'card_number' => [FILTER_VALIDATE_REGEXP, '/^(\d{16})$/'],
47
+	  'cvc' => [FILTER_VALIDATE_INT],
48
+	  'expiration' => [FILTER_VALIDATE_REGEXP, '/^(\d{2})\/(\d{4})$/'],
49
+	  'ip' => [FILTER_VALIDATE_IP],
50
+	];
51
+	return $this;
52 52
   }
53 53
 
54 54
   public function release(){
55
-    $this->validations = [
56
-      'amount' => [FILTER_VALIDATE_FLOAT],
57
-      'id' => [FILTER_VALIDATE_REGEXP, '/^([0-9a-f]{8})\-([0-9a-f]{4})\-([0-9a-f]{4})\-([0-9a-f]{4})\-([0-9a-f]{12})$/'],
58
-    ];
59
-    return $this;
55
+	$this->validations = [
56
+	  'amount' => [FILTER_VALIDATE_FLOAT],
57
+	  'id' => [FILTER_VALIDATE_REGEXP, '/^([0-9a-f]{8})\-([0-9a-f]{4})\-([0-9a-f]{4})\-([0-9a-f]{4})\-([0-9a-f]{12})$/'],
58
+	];
59
+	return $this;
60 60
   }
61 61
 
62 62
   public function query(){
63
-    $this->validations = [
64
-      'id' => [FILTER_VALIDATE_REGEXP, '/^([0-9a-f]{8})\-([0-9a-f]{4})\-([0-9a-f]{4})\-([0-9a-f]{4})\-([0-9a-f]{12})$/'],
65
-    ];
66
-    return $this;
63
+	$this->validations = [
64
+	  'id' => [FILTER_VALIDATE_REGEXP, '/^([0-9a-f]{8})\-([0-9a-f]{4})\-([0-9a-f]{4})\-([0-9a-f]{4})\-([0-9a-f]{12})$/'],
65
+	];
66
+	return $this;
67 67
   }
68 68
 
69 69
   public function validate($fields){
70
-    foreach ($this->validations as $key => $filters) {
71
-      if ( !$this->_validation($fields[$key], $filters) ){
72
-        throw new Exceptions\ValidationException("Error {$key}: {$fields[$key]}");
73
-      }
74
-    }
70
+	foreach ($this->validations as $key => $filters) {
71
+	  if ( !$this->_validation($fields[$key], $filters) ){
72
+		throw new Exceptions\ValidationException("Error {$key}: {$fields[$key]}");
73
+	  }
74
+	}
75 75
 
76 76
   }
77 77
 
78 78
   private function _validation ($value, $filters)
79 79
   {
80
-    $filter = $filters[0];
81
-    $flags = [];
82
-    if ($filter === FILTER_VALIDATE_REGEXP) {
83
-      $flags = [
84
-        "options" => [
85
-          "regexp"=> $filters[1],
86
-        ],
87
-      ];
88
-    }
89
-    return filter_var($value, $filter, $flags);
80
+	$filter = $filters[0];
81
+	$flags = [];
82
+	if ($filter === FILTER_VALIDATE_REGEXP) {
83
+	  $flags = [
84
+		"options" => [
85
+		  "regexp"=> $filters[1],
86
+		],
87
+	  ];
88
+	}
89
+	return filter_var($value, $filter, $flags);
90 90
   }
91 91
 }
92 92
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
     return $this;
52 52
   }
53 53
 
54
-  public function release(){
54
+  public function release() {
55 55
     $this->validations = [
56 56
       'amount' => [FILTER_VALIDATE_FLOAT],
57 57
       'id' => [FILTER_VALIDATE_REGEXP, '/^([0-9a-f]{8})\-([0-9a-f]{4})\-([0-9a-f]{4})\-([0-9a-f]{4})\-([0-9a-f]{12})$/'],
@@ -59,23 +59,23 @@  discard block
 block discarded – undo
59 59
     return $this;
60 60
   }
61 61
 
62
-  public function query(){
62
+  public function query() {
63 63
     $this->validations = [
64 64
       'id' => [FILTER_VALIDATE_REGEXP, '/^([0-9a-f]{8})\-([0-9a-f]{4})\-([0-9a-f]{4})\-([0-9a-f]{4})\-([0-9a-f]{12})$/'],
65 65
     ];
66 66
     return $this;
67 67
   }
68 68
 
69
-  public function validate($fields){
69
+  public function validate($fields) {
70 70
     foreach ($this->validations as $key => $filters) {
71
-      if ( !$this->_validation($fields[$key], $filters) ){
71
+      if ( ! $this->_validation($fields[$key], $filters)) {
72 72
         throw new Exceptions\ValidationException("Error {$key}: {$fields[$key]}");
73 73
       }
74 74
     }
75 75
 
76 76
   }
77 77
 
78
-  private function _validation ($value, $filters)
78
+  private function _validation($value, $filters)
79 79
   {
80 80
     $filter = $filters[0];
81 81
     $flags = [];
Please login to merge, or discard this patch.