<?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_30 implements IPruefziffer
{
  public static function check($pKtoNr, $pBlz, $pGewichtung = array(), $pPruefZifferStelle = 9)
  {
    $gewichtung = array(2, 0, 0, 0, 0, 1, 2, 1, 2, 0);

    $ktoNr = str_pad($pKtoNr, 10, '0', STR_PAD_LEFT);

    $ary = PruefZiffHelpers::gewichten($ktoNr, $gewichtung);
    $rest = array_sum($ary) % 10;

    $result = (10 - $rest) % 10;

    return $result == $ktoNr[$pPruefZifferStelle];
  }
}