1<?php 2 3/* 4 * This file is part of Respect/Validation. 5 * 6 * (c) Alexandre Gomes Gaigalas <alexandre@gaigalas.net> 7 * 8 * For the full copyright and license information, please view the "LICENSE.md" 9 * file that was distributed with this source code. 10 */ 11 12namespace Respect\Validation\Rules\Locale; 13 14use malkusch\bav\BAV; 15use Respect\Validation\Rules\AbstractRule; 16 17/** 18 * Validates a german bank account. 19 * 20 * This validator depends on the composer package "malkusch/bav". 21 * 22 * @author Markus Malkusch <markus@malkusch.de> 23 * 24 * @see BAV::isValidBankAccount() 25 */ 26class GermanBankAccount extends AbstractRule 27{ 28 /** 29 * @var string 30 */ 31 public $bank; 32 33 /** 34 * @var BAV 35 */ 36 public $bav; 37 38 /** 39 * @param BAV $bav 40 */ 41 public function __construct($bank, BAV $bav = null) 42 { 43 if (null === $bav) { 44 $bav = new BAV(); 45 } 46 $this->bav = $bav; 47 $this->bank = $bank; 48 } 49 50 /** 51 * @return bool 52 */ 53 public function validate($input) 54 { 55 return $this->bav->isValidBankAccount($this->bank, $input); 56 } 57} 58