• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pixelpeter / laravel-isocodes-validation / 14190359521

01 Apr 2025 08:01AM UTC coverage: 98.469% (+0.2%) from 98.261%
14190359521

push

github

web-flow
Merge pull request #9 from pixelpeter/fix_coveralls

UPDATE: use coveralls github action instead of php package

193 of 196 relevant lines covered (98.47%)

63.98 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

98.27
/src/IsoCodesValidator.php
1
<?php
2

3
namespace Pixelpeter\IsoCodesValidation;
4

5
use Exception;
6
use Illuminate\Support\Arr;
7
use Illuminate\Validation\Validator as BaseValidator;
8

9
class IsoCodesValidator extends BaseValidator
10
{
11
    /**
12
     * Validate a BBAN code
13
     *
14
     * @return mixed
15
     */
16
    public function validateBban(/** @scrutinizer ignore-unused */ $attribute, $value)
10✔
17
    {
18
        return $this->runIsoCodesValidator(\IsoCodes\Bban::class, $value);
10✔
19
    }
20

21
    /**
22
     * Validate a BSN (Dutch citizen service number)
23
     *
24
     * @return mixed
25
     */
26
    public function validateBsn(/** @scrutinizer ignore-unused */ $attribute, $value)
10✔
27
    {
28
        return $this->runIsoCodesValidator(\IsoCodes\Bsn::class, $value);
10✔
29
    }
30

31
    /**
32
     * Validate a CIF code
33
     *
34
     * @return mixed
35
     */
36
    public function validateCif(/** @scrutinizer ignore-unused */ $attribute, $value)
10✔
37
    {
38
        return $this->runIsoCodesValidator(\IsoCodes\Cif::class, $value);
10✔
39
    }
40

41
    /**
42
     * Validate a credit card number
43
     *
44
     * @return mixed
45
     */
46
    public function validateCreditcard(/** @scrutinizer ignore-unused */ $attribute, $value)
10✔
47
    {
48
        return $this->runIsoCodesValidator(\IsoCodes\CreditCard::class, $value);
10✔
49
    }
50

51
    // /**
52
    //  * Validate a EAN-8 code
53
    //  *
54
    //  * @param $attribute
55
    //  * @param $value
56
    //  * @return mixed
57
    //  */
58
    // public function validateEan8(/** @scrutinizer ignore-unused */ $attribute, $value)
59
    // {
60
    //     return $this->runIsoCodesValidator(\IsoCodes\Ean8::class, $value);
61
    // }
62

63
    /**
64
     * Validate a EAN-13 code
65
     *
66
     * @return mixed
67
     */
68
    public function validateEan13(/** @scrutinizer ignore-unused */ $attribute, $value)
10✔
69
    {
70
        return $this->runIsoCodesValidator(\IsoCodes\Ean13::class, $value);
10✔
71
    }
72

73
    /**
74
     * Validate a Global Document Type Identifier (GDTI)
75
     *
76
     * @return mixed
77
     */
78
    public function validateGdti(/** @scrutinizer ignore-unused */ $attribute, $value)
10✔
79
    {
80
        return $this->runIsoCodesValidator(\IsoCodes\Gdti::class, $value);
10✔
81
    }
82

83
    /**
84
     * Validate a Global Location Number (GLN)
85
     *
86
     * @return mixed
87
     */
88
    public function validateGln(/** @scrutinizer ignore-unused */ $attribute, $value)
10✔
89
    {
90
        return $this->runIsoCodesValidator(\IsoCodes\Gln::class, $value);
10✔
91
    }
92

93
    /**
94
     * Validate a Global Returnable Asset Identifier
95
     *
96
     * @return mixed
97
     */
98
    public function validateGrai(/** @scrutinizer ignore-unused */ $attribute, $value)
10✔
99
    {
100
        return $this->runIsoCodesValidator(\IsoCodes\Grai::class, $value);
10✔
101
    }
102

103
    /**
104
     * Validate a Global Service Relation Number (GS1)
105
     *
106
     * @return mixed
107
     */
108
    public function validateGsrn(/** @scrutinizer ignore-unused */ $attribute, $value)
10✔
109
    {
110
        return $this->runIsoCodesValidator(\IsoCodes\Gsrn::class, $value);
10✔
111
    }
112

113
    /**
114
     * Validate a GTIN-8 code
115
     *
116
     * @return mixed
117
     */
118
    public function validateGtin8(/** @scrutinizer ignore-unused */ $attribute, $value)
10✔
119
    {
120
        return $this->runIsoCodesValidator(\IsoCodes\Gtin8::class, $value);
10✔
121
    }
122

123
    /**
124
     * Validate a GTIN-12 code
125
     *
126
     * @return mixed
127
     */
128
    public function validateGtin12(/** @scrutinizer ignore-unused */ $attribute, $value)
10✔
129
    {
130
        return $this->runIsoCodesValidator(\IsoCodes\Gtin12::class, $value);
10✔
131
    }
132

133
    /**
134
     * Validate a GTIN-13 code
135
     *
136
     * @return mixed
137
     */
138
    public function validateGtin13(/** @scrutinizer ignore-unused */ $attribute, $value)
10✔
139
    {
140
        return $this->runIsoCodesValidator(\IsoCodes\Gtin13::class, $value);
10✔
141
    }
142

143
    /**
144
     * Validate a GTIN-14 code
145
     *
146
     * @return mixed
147
     */
148
    public function validateGtin14(/** @scrutinizer ignore-unused */ $attribute, $value)
10✔
149
    {
150
        return $this->runIsoCodesValidator(\IsoCodes\Gtin14::class, $value);
10✔
151
    }
152

153
    /**
154
     * Validate an IBAN
155
     *
156
     * @return mixed
157
     */
158
    public function validateIban(/** @scrutinizer ignore-unused */ $attribute, $value)
10✔
159
    {
160
        return $this->runIsoCodesValidator(\IsoCodes\Iban::class, $value);
10✔
161
    }
162

163
    /**
164
     * Validate a "numéro de sécurité sociale" (INSEE)
165
     *
166
     * @return mixed
167
     */
168
    public function validateInsee(/** @scrutinizer ignore-unused */ $attribute, $value)
10✔
169
    {
170
        return $this->runIsoCodesValidator(\IsoCodes\Insee::class, $value);
10✔
171
    }
172

173
    /**
174
     * Validate an IP address
175
     *
176
     * @return mixed
177
     */
178
    public function validateIpaddress(/** @scrutinizer ignore-unused */ $attribute, $value)
10✔
179
    {
180
        return $this->runIsoCodesValidator(\IsoCodes\IP::class, $value);
10✔
181
    }
182

183
    /**
184
     * Validate an ISBN
185
     *
186
     * @return mixed
187
     */
188
    public function validateIsbn($attribute, $value, $parameters)
20✔
189
    {
190
        $this->requireParameterCount(1, $parameters, 'isbn');
20✔
191
        $type = $this->prepareReference($attribute, $parameters);
20✔
192

193
        return $this->runIsoCodesValidator(\IsoCodes\Isbn::class, $value, $type);
20✔
194
    }
195

196
    /**
197
     * Validate an "International Securities Identification Number" (ISIN)
198
     *
199
     * @return mixed
200
     */
201
    public function validateIsin(/** @scrutinizer ignore-unused */ $attribute, $value)
10✔
202
    {
203
        return $this->runIsoCodesValidator(\IsoCodes\Isin::class, $value);
10✔
204
    }
205

206
    /**
207
     * Validate an "International Standard Music Number" or ISMN (ISO 10957)
208
     *
209
     * @return mixed
210
     */
211
    public function validateIsmn(/** @scrutinizer ignore-unused */ $attribute, $value)
10✔
212
    {
213
        return $this->runIsoCodesValidator(\IsoCodes\Ismn::class, $value);
10✔
214
    }
215

216
    /**
217
     * Validate an "International Standard Musical Work Code" (ISWC)
218
     *
219
     * @return mixed
220
     */
221
    public function validateIswc(/** @scrutinizer ignore-unused */ $attribute, $value)
10✔
222
    {
223
        return $this->runIsoCodesValidator(\IsoCodes\Iswc::class, $value);
10✔
224
    }
225

226
    /**
227
     * Validate a MAC address
228
     *
229
     * @return mixed
230
     */
231
    public function validateMac(/** @scrutinizer ignore-unused */ $attribute, $value)
10✔
232
    {
233
        return $this->runIsoCodesValidator(\IsoCodes\Mac::class, $value);
10✔
234
    }
235

236
    /**
237
     * Validate a "Número de Identificación Fiscal" (NIF)
238
     *
239
     * @return mixed
240
     */
241
    public function validateNif(/** @scrutinizer ignore-unused */ $attribute, $value)
10✔
242
    {
243
        return $this->runIsoCodesValidator(\IsoCodes\Nif::class, $value);
10✔
244
    }
245

246
    /**
247
     * Validate a "Organisme Type12 Norme B2"
248
     *
249
     * @return mixed
250
     */
251
    public function validateOrganismeType12NormeB2($attribute, $value, $parameters)
20✔
252
    {
253
        $this->requireParameterCount(1, $parameters, 'organisme_type12_norme_b2');
20✔
254
        $clef = $this->prepareReference($attribute, $parameters);
20✔
255

256
        return $this->runIsoCodesValidator(\IsoCodes\OrganismeType12NormeB2::class, $value, $clef);
20✔
257
    }
258

259
    /**
260
     * Validate a phone number
261
     *
262
     * @return mixed
263
     */
264
    public function validatePhonenumber($attribute, $value, $parameters)
20✔
265
    {
266
        $this->requireParameterCount(1, $parameters, 'phonenumber');
20✔
267
        $country = $this->prepareReference($attribute, $parameters);
20✔
268

269
        return $this->runIsoCodesValidator(\IsoCodes\PhoneNumber::class, $value, $country);
20✔
270
    }
271

272
    /**
273
     * Validate a Stock Exchange Daily Official List (SEDOL)
274
     *
275
     * @return mixed
276
     */
277
    public function validateSedol(/** @scrutinizer ignore-unused */ $attribute, $value)
10✔
278
    {
279
        return $this->runIsoCodesValidator(\IsoCodes\Sedol::class, $value);
10✔
280
    }
281

282
    /**
283
     * Validate "Système d’Identification du Répertoire des Entreprises" (SIREN)
284
     *
285
     * @return mixed
286
     */
287
    public function validateSiren(/** @scrutinizer ignore-unused */ $attribute, $value)
10✔
288
    {
289
        return $this->runIsoCodesValidator(\IsoCodes\Siren::class, $value);
10✔
290
    }
291

292
    /**
293
     * Validate "Système d’Identification du Répertoire des ETablissements" (SIRET)
294
     *
295
     * @return mixed
296
     */
297
    public function validateSiret(/** @scrutinizer ignore-unused */ $attribute, $value)
10✔
298
    {
299
        return $this->runIsoCodesValidator(\IsoCodes\Siret::class, $value);
10✔
300
    }
301

302
    /**
303
     * Validate a European/International Article Number (SSCC)
304
     *
305
     * @return mixed
306
     */
307
    public function validateSscc(/** @scrutinizer ignore-unused */ $attribute, $value)
10✔
308
    {
309
        return $this->runIsoCodesValidator(\IsoCodes\Sscc::class, $value);
10✔
310
    }
311

312
    /**
313
     * Validate a Social Security Number (SSN)
314
     *
315
     * @return mixed
316
     */
317
    public function validateSsn(/** @scrutinizer ignore-unused */ $attribute, $value)
10✔
318
    {
319
        return $this->runIsoCodesValidator(\IsoCodes\Ssn::class, $value);
10✔
320
    }
321

322
    /**
323
     * Validate structured communication
324
     *
325
     * @return mixed
326
     */
327
    public function validateStructuredCommunication(/** @scrutinizer ignore-unused */ $attribute, $value)
10✔
328
    {
329
        return $this->runIsoCodesValidator(\IsoCodes\StructuredCommunication::class, $value);
10✔
330
    }
331

332
    /**
333
     * Validate a SWIFT/BIC
334
     *
335
     * @return mixed
336
     */
337
    public function validateSwiftBic(/** @scrutinizer ignore-unused */ $attribute, $value)
10✔
338
    {
339
        return $this->runIsoCodesValidator(\IsoCodes\SwiftBic::class, $value);
10✔
340
    }
341

342
    /**
343
     * Validate a Unique Device Identification
344
     *
345
     * @return mixed
346
     */
347
    public function validateUdi(/** @scrutinizer ignore-unused */ $attribute, $value)
10✔
348
    {
349
        return $this->runIsoCodesValidator(\IsoCodes\Udi::class, $value);
10✔
350
    }
351

352
    /**
353
     * Validate a UK National Insurance Number
354
     *
355
     * @return mixed
356
     */
357
    public function validateUknin(/** @scrutinizer ignore-unused */ $attribute, $value)
10✔
358
    {
359
        return $this->runIsoCodesValidator(\IsoCodes\Uknin::class, $value);
10✔
360
    }
361

362
    /**
363
     * Validate a Universal Product Code
364
     *
365
     * @return mixed
366
     */
367
    public function validateUpca(/** @scrutinizer ignore-unused */ $attribute, $value)
10✔
368
    {
369
        return $this->runIsoCodesValidator(\IsoCodes\Upca::class, $value);
10✔
370
    }
371

372
    /**
373
     * Validate Value Added Tax (VAT)
374
     *
375
     * @return mixed
376
     */
377
    public function validateVat(/** @scrutinizer ignore-unused */ $attribute, $value)
10✔
378
    {
379
        return $this->runIsoCodesValidator(\IsoCodes\Vat::class, $value);
10✔
380
    }
381

382
    /**
383
     * Validate a zip code
384
     *
385
     * @return mixed
386
     */
387
    public function validateZipcode($attribute, $value, $parameters)
20✔
388
    {
389
        $this->requireParameterCount(1, $parameters, 'zipcode');
20✔
390
        $country = $this->prepareReference($attribute, $parameters);
20✔
391

392
        return $this->runIsoCodesValidator(\IsoCodes\ZipCode::class, $value, $country);
20✔
393
    }
394

395
    /**
396
     * Prepare/get the reference when defined in dot notation
397
     *
398
     * @return mixed
399
     */
400
    protected function prepareReference($attribute, $parameters)
80✔
401
    {
402
        if ($keys = $this->getExplicitKeys($attribute)) {
80✔
403
            $parameters = $this->replaceAsterisksInParameters($parameters, $keys);
40✔
404
        }
405

406
        return Arr::get($this->data, $parameters[0], $parameters[0]);
80✔
407
    }
408

409
    /**
410
     * Execute the validation function
411
     * and catch every other Exception from underlying libraries
412
     * so we will only display the Laravel validation error
413
     *
414
     * @param  mixed  $reference
415
     * @return mixed
416
     */
417
    protected function runIsoCodesValidator($validator, $value, $reference = '')
400✔
418
    {
419
        try {
420
            if (empty($reference)) {
400✔
421
                return call_user_func($validator.'::validate', $value);
320✔
422
            }
423

424
            return call_user_func($validator.'::validate', $value, $reference);
80✔
425
        } catch (Exception $e) {
×
426
            // do nothing
427
        }
428
    }
429

430
    /**
431
     * Replace all country place-holders
432
     *
433
     * @param  $parameter
434
     * @return mixed
435
     */
436
    protected function countryReplacer($message, $reference)
20✔
437
    {
438
        return str_replace(':country', $reference, $message);
20✔
439
    }
440

441
    /**
442
     * Replace all value place-holders
443
     *
444
     * @return mixed
445
     */
446
    protected function valueReplacer($message, $attribute)
200✔
447
    {
448
        return str_replace(':value', $this->getValue($attribute), $message);
200✔
449
    }
450

451
    /**
452
     * Replace all place-holders for the bban rule
453
     *
454
     * @param  $rule
455
     * @param  $parameter
456
     * @return mixed
457
     */
458
    public function replaceBban($message, $attribute)
5✔
459
    {
460
        return $this->valueReplacer($message, $attribute);
5✔
461
    }
462

463
    /**
464
     * Replace all place-holders for the bsn rule
465
     *
466
     * @param  $rule
467
     * @param  $parameter
468
     * @return mixed
469
     */
470
    public function replaceBsn($message, $attribute)
5✔
471
    {
472
        return $this->valueReplacer($message, $attribute);
5✔
473
    }
474

475
    /**
476
     * Replace all place-holders for the cif rule
477
     *
478
     * @param  $rule
479
     * @param  $parameter
480
     * @return mixed
481
     */
482
    public function replaceCif($message, $attribute)
5✔
483
    {
484
        return $this->valueReplacer($message, $attribute);
5✔
485
    }
486

487
    /**
488
     * Replace all place-holders for the creditcard rule
489
     *
490
     * @param  $rule
491
     * @param  $parameter
492
     * @return mixed
493
     */
494
    public function replaceCreditcard($message, $attribute)
5✔
495
    {
496
        return $this->valueReplacer($message, $attribute);
5✔
497
    }
498

499
    /**
500
     * Replace all place-holders for the ena8 rule
501
     *
502
     * @param  $rule
503
     * @param  $parameter
504
     * @return mixed
505
     */
506
    public function replaceEan8($message, $attribute)
×
507
    {
508
        return $this->valueReplacer($message, $attribute);
×
509
    }
510

511
    /**
512
     * Replace all place-holders for the ean13 rule
513
     *
514
     * @param  $rule
515
     * @param  $parameter
516
     * @return mixed
517
     */
518
    public function replaceEan13($message, $attribute)
5✔
519
    {
520
        return $this->valueReplacer($message, $attribute);
5✔
521
    }
522

523
    /**
524
     * Replace all place-holders for the gdti rule
525
     *
526
     * @param  $rule
527
     * @param  $parameter
528
     * @return mixed
529
     */
530
    public function replaceGdti($message, $attribute)
5✔
531
    {
532
        return $this->valueReplacer($message, $attribute);
5✔
533
    }
534

535
    /**
536
     * Replace all place-holders for the gln rule
537
     *
538
     * @param  $rule
539
     * @param  $parameter
540
     * @return mixed
541
     */
542
    public function replaceGln($message, $attribute)
5✔
543
    {
544
        return $this->valueReplacer($message, $attribute);
5✔
545
    }
546

547
    /**
548
     * Replace all place-holders for the grai rule
549
     *
550
     * @param  $rule
551
     * @param  $parameter
552
     * @return mixed
553
     */
554
    public function replaceGrai($message, $attribute)
5✔
555
    {
556
        return $this->valueReplacer($message, $attribute);
5✔
557
    }
558

559
    /**
560
     * Replace all place-holders for the gsrn rule
561
     *
562
     * @param  $rule
563
     * @param  $parameter
564
     * @return mixed
565
     */
566
    public function replaceGsrn($message, $attribute)
5✔
567
    {
568
        return $this->valueReplacer($message, $attribute);
5✔
569
    }
570

571
    /**
572
     * Replace all place-holders for the gitin8 rule
573
     *
574
     * @param  $rule
575
     * @param  $parameter
576
     * @return mixed
577
     */
578
    public function replaceGtin8($message, $attribute)
5✔
579
    {
580
        return $this->valueReplacer($message, $attribute);
5✔
581
    }
582

583
    /**
584
     * Replace all place-holders for the gtin12 rule
585
     *
586
     * @param  $rule
587
     * @param  $parameter
588
     * @return mixed
589
     */
590
    public function replaceGtin12($message, $attribute)
5✔
591
    {
592
        return $this->valueReplacer($message, $attribute);
5✔
593
    }
594

595
    /**
596
     * Replace all place-holders for the gtin13 rule
597
     *
598
     * @param  $rule
599
     * @param  $parameter
600
     * @return mixed
601
     */
602
    public function replaceGtin13($message, $attribute)
5✔
603
    {
604
        return $this->valueReplacer($message, $attribute);
5✔
605
    }
606

607
    /**
608
     * Replace all place-holders for the gtin14 rule
609
     *
610
     * @param  $rule
611
     * @param  $parameter
612
     * @return mixed
613
     */
614
    public function replaceGtin14($message, $attribute)
5✔
615
    {
616
        return $this->valueReplacer($message, $attribute);
5✔
617
    }
618

619
    /**
620
     * Replace all place-holders for the iban rule
621
     *
622
     * @param  $rule
623
     * @param  $parameter
624
     * @return mixed
625
     */
626
    public function replaceIban($message, $attribute)
5✔
627
    {
628
        return $this->valueReplacer($message, $attribute);
5✔
629
    }
630

631
    /**
632
     * Replace all place-holders for the insee rule
633
     *
634
     * @param  $rule
635
     * @param  $parameter
636
     * @return mixed
637
     */
638
    public function replaceInsee($message, $attribute)
5✔
639
    {
640
        return $this->valueReplacer($message, $attribute);
5✔
641
    }
642

643
    /**
644
     * Replace all place-holders for the ipaddress rule
645
     *
646
     * @param  $rule
647
     * @param  $parameter
648
     * @return mixed
649
     */
650
    public function replaceIpaddress($message, $attribute)
5✔
651
    {
652
        return $this->valueReplacer($message, $attribute);
5✔
653
    }
654

655
    /**
656
     * Replace all place-holders for the isbn rule
657
     *
658
     * @param  $rule
659
     * @param  $parameter
660
     * @return mixed
661
     */
662
    public function replaceIsbn($message, $attribute)
10✔
663
    {
664
        return $this->valueReplacer($message, $attribute);
10✔
665
    }
666

667
    /**
668
     * Replace all place-holders for the isin rule
669
     *
670
     * @param  $rule
671
     * @param  $parameter
672
     * @return mixed
673
     */
674
    public function replaceIsin($message, $attribute)
5✔
675
    {
676
        return $this->valueReplacer($message, $attribute);
5✔
677
    }
678

679
    /**
680
     * Replace all place-holders for the ismn rule
681
     *
682
     * @param  $rule
683
     * @param  $parameter
684
     * @return mixed
685
     */
686
    public function replaceIsmn($message, $attribute)
5✔
687
    {
688
        return $this->valueReplacer($message, $attribute);
5✔
689
    }
690

691
    /**
692
     * Replace all place-holders for the iswc rule
693
     *
694
     * @param  $rule
695
     * @param  $parameter
696
     * @return mixed
697
     */
698
    public function replaceIswc($message, $attribute)
5✔
699
    {
700
        return $this->valueReplacer($message, $attribute);
5✔
701
    }
702

703
    /**
704
     * Replace all place-holders for the mac rule
705
     *
706
     * @param  $rule
707
     * @param  $parameter
708
     * @return mixed
709
     */
710
    public function replaceMac($message, $attribute)
5✔
711
    {
712
        return $this->valueReplacer($message, $attribute);
5✔
713
    }
714

715
    /**
716
     * Replace all place-holders for the nif rule
717
     *
718
     * @param  $rule
719
     * @param  $parameter
720
     * @return mixed
721
     */
722
    public function replaceNif($message, $attribute)
5✔
723
    {
724
        return $this->valueReplacer($message, $attribute);
5✔
725
    }
726

727
    /**
728
     * Replace all place-holders for the organisme_type12_norme_b2 rule
729
     *
730
     * @param  $rule
731
     * @param  $parameter
732
     * @return mixed
733
     */
734
    public function replaceOrganismeType12NormeB2($message, $attribute)
10✔
735
    {
736
        return $this->valueReplacer($message, $attribute);
10✔
737
    }
738

739
    /**
740
     * Replace all place-holders for the phonenumber rule
741
     *
742
     * @return mixed
743
     */
744
    protected function replacePhonenumber($message, $attribute, /** @scrutinizer ignore-unused */ $rule, $parameter)
10✔
745
    {
746
        $reference = $this->prepareReference($attribute, $parameter);
10✔
747

748
        $message = $this->valueReplacer($message, $attribute);
10✔
749
        $message = $this->countryReplacer($message, $reference);
10✔
750

751
        return $message;
10✔
752
    }
753

754
    /**
755
     * Replace all place-holders for the sedol rule
756
     *
757
     * @param  $rule
758
     * @param  $parameter
759
     * @return mixed
760
     */
761
    public function replaceSedol($message, $attribute)
5✔
762
    {
763
        return $this->valueReplacer($message, $attribute);
5✔
764
    }
765

766
    /**
767
     * Replace all place-holders for the siren rule
768
     *
769
     * @param  $rule
770
     * @param  $parameter
771
     * @return mixed
772
     */
773
    public function replaceSiren($message, $attribute)
5✔
774
    {
775
        return $this->valueReplacer($message, $attribute);
5✔
776
    }
777

778
    /**
779
     * Replace all place-holders for the siret rule
780
     *
781
     * @param  $rule
782
     * @param  $parameter
783
     * @return mixed
784
     */
785
    public function replaceSiret($message, $attribute)
5✔
786
    {
787
        return $this->valueReplacer($message, $attribute);
5✔
788
    }
789

790
    /**
791
     * Replace all place-holders for the sscc rule
792
     *
793
     * @param  $rule
794
     * @param  $parameter
795
     * @return mixed
796
     */
797
    public function replaceSscc($message, $attribute)
5✔
798
    {
799
        return $this->valueReplacer($message, $attribute);
5✔
800
    }
801

802
    /**
803
     * Replace all place-holders for the ssn rule
804
     *
805
     * @param  $rule
806
     * @param  $parameter
807
     * @return mixed
808
     */
809
    public function replaceSSn($message, $attribute)
5✔
810
    {
811
        return $this->valueReplacer($message, $attribute);
5✔
812
    }
813

814
    /**
815
     * Replace all place-holders for the structured_communication rule
816
     *
817
     * @param  $rule
818
     * @param  $parameter
819
     * @return mixed
820
     */
821
    public function replaceStructuredCommunication($message, $attribute)
5✔
822
    {
823
        return $this->valueReplacer($message, $attribute);
5✔
824
    }
825

826
    /**
827
     * Replace all place-holders for the swift_bic rule
828
     *
829
     * @param  $rule
830
     * @param  $parameter
831
     * @return mixed
832
     */
833
    public function replaceSwiftBic($message, $attribute)
5✔
834
    {
835
        return $this->valueReplacer($message, $attribute);
5✔
836
    }
837

838
    /**
839
     * Replace all place-holders for the udi rule
840
     *
841
     * @param  $rule
842
     * @param  $parameter
843
     * @return mixed
844
     */
845
    public function replaceUdi($message, $attribute)
5✔
846
    {
847
        return $this->valueReplacer($message, $attribute);
5✔
848
    }
849

850
    /**
851
     * Replace all place-holders for the uknin rule
852
     *
853
     * @param  $rule
854
     * @param  $parameter
855
     * @return mixed
856
     */
857
    public function replaceUknin($message, $attribute)
5✔
858
    {
859
        return $this->valueReplacer($message, $attribute);
5✔
860
    }
861

862
    /**
863
     * Replace all place-holders for the upca rule
864
     *
865
     * @param  $rule
866
     * @param  $parameter
867
     * @return mixed
868
     */
869
    public function replaceUpca($message, $attribute)
5✔
870
    {
871
        return $this->valueReplacer($message, $attribute);
5✔
872
    }
873

874
    /**
875
     * Replace all place-holders for the vat rule
876
     *
877
     * @param  $rule
878
     * @param  $parameter
879
     * @return mixed
880
     */
881
    public function replaceVat($message, $attribute)
5✔
882
    {
883
        return $this->valueReplacer($message, $attribute);
5✔
884
    }
885

886
    /**
887
     * Replace all place-holders for the zipcode rule
888
     *
889
     * @return mixed
890
     */
891
    public function replaceZipcode($message, $attribute, /** @scrutinizer ignore-unused */ $rule, $parameter)
10✔
892
    {
893
        $reference = $this->prepareReference($attribute, $parameter);
10✔
894

895
        $message = $this->valueReplacer($message, $attribute);
10✔
896
        $message = $this->countryReplacer($message, $reference);
10✔
897

898
        return $message;
10✔
899
    }
900
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc