original_string: public function calcChecksum($input)
      {
          $wi = array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2);
          $sum = 0;
  
          for ($i = 16; $i >= 0; $i--) {
              $sum += $input[$i] * $wi[$i];
          }
  
          $checksum = (12 - $sum % 11) % 11;
  
          return $checksum == 10 ? 'X' : (string)$checksum;
      }
code: public function calcChecksum($input)
      {
          $wi = array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2);
          $sum = 0;
  
          for ($i = 16; $i >= 0; $i--) {
              $sum += $input[$i] * $wi[$i];
          }
  
          $checksum = (12 - $sum % 11) % 11;
  
          return $checksum == 10 ? 'X' : (string)$checksum;
      }
code_tokens: public function calcChecksum ( $ input ) { $ wi = array ( 7 , 9 , 10 , 5 , 8 , 4 , 2 , 1 , 6 , 3 , 7 , 9 , 10 , 5 , 8 , 4 , 2 ) ; $ sum = 0 ; for ( $ i = 16 ; $ i >= 0 ; $ i -- ) { $ sum += $ input [ $ i ] * $ wi [ $ i ] ; } $ checksum = ( 12 - $ sum % 11 ) % 11 ; return $ checksum == 10 ? 'X' : ( string ) $ checksum ; }
docstring: Calculate the final digit of id card
  
  @param string $input The 17 or 18-digit code
  @return string
docstring_tokens: Calculate the final digit of id card