/**
  * Luhn algorithm
  *
  * @see http://en.wikipedia.org/wiki/Luhn_algorithm
  * @return boolean Success
  * @access protected
  */
 function _luhn()
 {
     $_this =& WPToolset_Cake_Validation::getInstance();
     if ($_this->deep !== true) {
         return true;
     }
     if ($_this->check == 0) {
         return false;
     }
     $sum = 0;
     $length = strlen($_this->check);
     for ($position = 1 - $length % 2; $position < $length; $position += 2) {
         $sum += $_this->check[$position];
     }
     for ($position = $length % 2; $position < $length; $position += 2) {
         $number = $_this->check[$position] * 2;
         $sum += $number < 10 ? $number : $number - 9;
     }
     return $sum % 10 == 0;
 }