<?php
/**
 * @copyright (c) Kufer Software GmbH, Loisachstrasse 4, D-84453 Mühldorf
 */

/**
 * @copyright (c) Kufer Software GmbH, Loisachstrasse 4, D-84453 Mühldorf
 */
class Pruefziffer_D1 implements IPruefziffer
{
  public static function check($pKtoNr, $pBlz, $pGewichtung = array(), $pPruefZifferStelle = 15)
  {
    $ktoNr = \str_pad($pKtoNr, 10, '0', STR_PAD_LEFT);

    $gewichtung = array(0, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2);

    if ($ktoNr[0] == 8) {
      return false;
    }

    $konstante = (string)(4363380 + $ktoNr[0]);

    $ktoNrMitKonstante = $konstante . substr($ktoNr, 1, 9);

    return Pruefziffer_00::check($ktoNrMitKonstante, $pBlz, $gewichtung, $pPruefZifferStelle);
  }
}