original_string: public static function getISBN13CheckDigit($isbn)
      {
          $sum = 0;
          $weight = 1;
          for ($x = 0; $x < strlen($isbn); $x++) {
              $sum += intval(substr($isbn, $x, 1)) * $weight;
              $weight = $weight == 1 ? 3 : 1;
          }
          $retval = 10 - ($sum % 10);
          return $retval == 10 ? 0 : $retval;
      }
code: public static function getISBN13CheckDigit($isbn)
      {
          $sum = 0;
          $weight = 1;
          for ($x = 0; $x < strlen($isbn); $x++) {
              $sum += intval(substr($isbn, $x, 1)) * $weight;
              $weight = $weight == 1 ? 3 : 1;
          }
          $retval = 10 - ($sum % 10);
          return $retval == 10 ? 0 : $retval;
      }
code_tokens: public static function getISBN13CheckDigit ( $ isbn ) { $ sum = 0 ; $ weight = 1 ; for ( $ x = 0 ; $ x < strlen ( $ isbn ) ; $ x ++ ) { $ sum += intval ( substr ( $ isbn , $ x , 1 ) ) * $ weight ; $ weight = $ weight == 1 ? 3 : 1 ; } $ retval = 10 - ( $ sum % 10 ) ; return $ retval == 10 ? 0 : $ retval ; }
docstring: Given the first 12 digits of an ISBN-13, generate the check digit.
  
  @param string $isbn The first 12 digits of an ISBN-13.
  
  @return string      The check digit.
docstring_tokens: Given the first 12 digits of an ISBN - 13 generate the check digit .