<?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_97 implements IPruefziffer
{
  public static function check($pKtoNr, $pBlz, $pGewichtung = array(), $pPruefZifferStelle = 9)
  {
    $ktoNr = \str_pad($pKtoNr, 10, '0', STR_PAD_LEFT);

    if (strlen((string)($ktoNr * 1)) < 5) {
      return false;
    }

    $ktoNrOhnePZ = (int)($ktoNr / 10);
    $zahl = (int)($ktoNrOhnePZ / 11);
    $zahl *= 11;
    $result = ($ktoNrOhnePZ - $zahl) % 10;

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