Inheritance: implements isocodes\IsoCodeInterface
Beispiel #1
0
 /**
  * testInvalidSwiftBic
  *
  * @param mixed $swiftBic
  *
  * @dataProvider getInvalidSwiftBic
  *
  * return void
  */
 public function testInvalidSwiftBic($swiftBic)
 {
     $this->assertFalse(SwiftBic::validate($swiftBic));
 }
Beispiel #2
0
 /**
  * @param string $value
  */
 private function __construct($value)
 {
     Guard::true(empty($value) || SwiftBicValidator::validate($value), 'Must be a valid BIC/SWIFT code (ISO-9362)');
     $this->value = $value;
 }
 private static function setContraBic(&$entry, $values)
 {
     $split = explode($entry->postingLineId, $values[1], 2);
     // after id and before iban
     if (isset($split[1]) && strlen($entry->contraAccount) > 0) {
         $split2 = explode($entry->contraAccount, $split[1], 2);
         if (isset($split2[0])) {
             $result = preg_match("/ ([a-zA-Z]){4}([a-zA-Z]){2}([0-9a-zA-Z]){2}([0-9a-zA-Z]{3})? /", $split2[0], $matches);
             $result2 = preg_match("/ ([0-9]){5} /", $split2[0], $matches2);
             $date = new DateTime($entry->valueDate);
             if ($result === 1 && \IsoCodes\SwiftBic::validate(trim($matches[0]))) {
                 $entry->contraBic = trim($matches[0]);
                 return;
             } else {
                 if ($result2 === 1 && $date->format('Y') < 2014) {
                     $entry->contraBic = trim($matches2[0]);
                     return;
                 }
             }
         }
     }
     $entry->contraBic = '';
 }