original_string: public function decode($data)
      {
  
          // Make sure we have a valid data string.
          $mod = strlen($data) % 8;
          if ($mod === 1 || $mod === 3 || $mod === 6) {
              throw new \DomainException('Invalid input.');
          }
  
          // Convert the data to a binary string.
          $bits = '';
          foreach (str_split(strtoupper($data)) as $char) {
              $index = strpos($this->getConfig('alphabet'), $char);
              if ($index === false) {
                  throw new \DomainException('Invalid character in input.');
              }
              $bits .= sprintf('%05b', $index);
          }
  
          // Make sure padding is all zeroes.
          if (preg_match('/[^0]/', substr($bits, 0 - strlen($bits) % 8)) === 1) {
              throw new \DomainException('Invalid input.');
          }
  
          // Decode the binary string.
          $output = '';
          foreach (str_split($bits, 8) as $chunk) {
              $output .= chr(bindec($chunk));
          }
          return rtrim($output);
  
      }
code: public function decode($data)
      {
  
          // Make sure we have a valid data string.
          $mod = strlen($data) % 8;
          if ($mod === 1 || $mod === 3 || $mod === 6) {
              throw new \DomainException('Invalid input.');
          }
  
          // Convert the data to a binary string.
          $bits = '';
          foreach (str_split(strtoupper($data)) as $char) {
              $index = strpos($this->getConfig('alphabet'), $char);
              if ($index === false) {
                  throw new \DomainException('Invalid character in input.');
              }
              $bits .= sprintf('%05b', $index);
          }
  
          // Make sure padding is all zeroes.
          if (preg_match('/[^0]/', substr($bits, 0 - strlen($bits) % 8)) === 1) {
              throw new \DomainException('Invalid input.');
          }
  
          // Decode the binary string.
          $output = '';
          foreach (str_split($bits, 8) as $chunk) {
              $output .= chr(bindec($chunk));
          }
          return rtrim($output);
  
      }
code_tokens: public function decode ( $ data ) { // Make sure we have a valid data string. $ mod = strlen ( $ data ) % 8 ; if ( $ mod === 1 || $ mod === 3 || $ mod === 6 ) { throw new \ DomainException ( 'Invalid input.' ) ; } // Convert the data to a binary string. $ bits = '' ; foreach ( str_split ( strtoupper ( $ data ) ) as $ char ) { $ index = strpos ( $ this -> getConfig ( 'alphabet' ) , $ char ) ; if ( $ index === false ) { throw new \ DomainException ( 'Invalid character in input.' ) ; } $ bits .= sprintf ( '%05b' , $ index ) ; } // Make sure padding is all zeroes. if ( preg_match ( '/[^0]/' , substr ( $ bits , 0 - strlen ( $ bits ) % 8 ) ) === 1 ) { throw new \ DomainException ( 'Invalid input.' ) ; } // Decode the binary string. $ output = '' ; foreach ( str_split ( $ bits , 8 ) as $ chunk ) { $ output .= chr ( bindec ( $ chunk ) ) ; } return rtrim ( $ output ) ; }
docstring: Decode a base32 string.
  
  @param string $data The string to decode.
  
  @return string The decoded string.
docstring_tokens: Decode a base32 string .