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

pixelpeter / laravel5-isocodes-validation / 15052749466

15 May 2025 06:42PM UTC coverage: 98.98%. Remained the same
15052749466

push

github

web-flow
Merge pull request #41 from pixelpeter/dependabot/github_actions/dependabot/fetch-metadata-2.4.0

Bump dependabot/fetch-metadata from 2.3.0 to 2.4.0

194 of 196 relevant lines covered (98.98%)

71.08 hits per line

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

98.86
/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)
12✔
17
    {
18
        return $this->runIsoCodesValidator(\IsoCodes\Bban::class, $value);
12✔
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)
12✔
27
    {
28
        return $this->runIsoCodesValidator(\IsoCodes\Bsn::class, $value);
12✔
29
    }
30

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

191
        return $this->runIsoCodesValidator(\IsoCodes\Isbn::class, $value, $type);
24✔
192
    }
193

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

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

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

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

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

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

254
        return $this->runIsoCodesValidator(\IsoCodes\OrganismeType12NormeB2::class, $value, $clef);
24✔
255
    }
256

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

267
        return $this->runIsoCodesValidator(\IsoCodes\PhoneNumber::class, $value, $country);
24✔
268
    }
269

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

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

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

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

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

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

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

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

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

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

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

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

390
        return $this->runIsoCodesValidator(\IsoCodes\ZipCode::class, $value, $country);
24✔
391
    }
392

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

404
        return Arr::get($this->data, $parameters[0], $parameters[0]);
96✔
405
    }
406

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

746
        $message = $this->valueReplacer($message, $attribute);
12✔
747
        $message = $this->countryReplacer($message, $reference);
12✔
748

749
        return $message;
12✔
750
    }
751

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

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

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

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

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

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

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

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

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

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

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

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

893
        $message = $this->valueReplacer($message, $attribute);
12✔
894
        $message = $this->countryReplacer($message, $reference);
12✔
895

896
        return $message;
12✔
897
    }
898
}
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

© 2026 Coveralls, Inc