original_string: private function _isReserved($host){
          if (!preg_match('/^([0-9]{1,3}\.){3}[0-9]{1,3}$/', $host)) {
              $host = gethostbyname($host);
          }
  
          $octet = explode('.',$host);
          if ((int)$octet[0] >= 224) {
              return true;
          } else if (array_key_exists($octet[0], $this->_invalidIp)) {
              foreach ((array)$this->_invalidIp[$octet[0]] as $subnetData) {
                  // we skip the first loop as we already know that octet matches
                  for ($i = 1; $i < 4; $i++) {
                      if (strpos($subnetData, $octet[$i]) !== $i * 4) {
                          break;
                      }
                  }
  
                  $host       = explode("/", $subnetData);
                  $binaryHost = "";
                  $tmp        = explode(".", $host[0]);
                  for ($i = 0; $i < 4 ; $i++) {
                      $binaryHost .= str_pad(decbin($tmp[$i]), 8, "0", STR_PAD_LEFT);
                  }
  
                  $segmentData = array(
                      'network'   => (int)$this->_toIp(str_pad(substr($binaryHost, 0, $host[1]), 32, 0)),
                      'broadcast' => (int)$this->_toIp(str_pad(substr($binaryHost, 0, $host[1]), 32, 1))
                  );
  
                  for ($j = $i; $j < 4; $j++) {
                      if ((int)$octet[$j] < $segmentData['network'][$j] ||
                          (int)$octet[$j] > $segmentData['broadcast'][$j]) {
                          return false;
                      }
                  }
              }
  
              return true;
          } else {
              return false;
          }
      }
code: private function _isReserved($host){
          if (!preg_match('/^([0-9]{1,3}\.){3}[0-9]{1,3}$/', $host)) {
              $host = gethostbyname($host);
          }
  
          $octet = explode('.',$host);
          if ((int)$octet[0] >= 224) {
              return true;
          } else if (array_key_exists($octet[0], $this->_invalidIp)) {
              foreach ((array)$this->_invalidIp[$octet[0]] as $subnetData) {
                  // we skip the first loop as we already know that octet matches
                  for ($i = 1; $i < 4; $i++) {
                      if (strpos($subnetData, $octet[$i]) !== $i * 4) {
                          break;
                      }
                  }
  
                  $host       = explode("/", $subnetData);
                  $binaryHost = "";
                  $tmp        = explode(".", $host[0]);
                  for ($i = 0; $i < 4 ; $i++) {
                      $binaryHost .= str_pad(decbin($tmp[$i]), 8, "0", STR_PAD_LEFT);
                  }
  
                  $segmentData = array(
                      'network'   => (int)$this->_toIp(str_pad(substr($binaryHost, 0, $host[1]), 32, 0)),
                      'broadcast' => (int)$this->_toIp(str_pad(substr($binaryHost, 0, $host[1]), 32, 1))
                  );
  
                  for ($j = $i; $j < 4; $j++) {
                      if ((int)$octet[$j] < $segmentData['network'][$j] ||
                          (int)$octet[$j] > $segmentData['broadcast'][$j]) {
                          return false;
                      }
                  }
              }
  
              return true;
          } else {
              return false;
          }
      }
code_tokens: private function _isReserved ( $ host ) { if ( ! preg_match ( '/^([0-9]{1,3}\.){3}[0-9]{1,3}$/' , $ host ) ) { $ host = gethostbyname ( $ host ) ; } $ octet = explode ( '.' , $ host ) ; if ( ( int ) $ octet [ 0 ] >= 224 ) { return true ; } else if ( array_key_exists ( $ octet [ 0 ] , $ this -> _invalidIp ) ) { foreach ( ( array ) $ this -> _invalidIp [ $ octet [ 0 ] ] as $ subnetData ) { // we skip the first loop as we already know that octet matches for ( $ i = 1 ; $ i < 4 ; $ i ++ ) { if ( strpos ( $ subnetData , $ octet [ $ i ] ) !== $ i * 4 ) { break ; } } $ host = explode ( "/" , $ subnetData ) ; $ binaryHost = "" ; $ tmp = explode ( "." , $ host [ 0 ] ) ; for ( $ i = 0 ; $ i < 4 ; $ i ++ ) { $ binaryHost .= str_pad ( decbin ( $ tmp [ $ i ] ) , 8 , "0" , STR_PAD_LEFT ) ; } $ segmentData = array ( 'network' => ( int ) $ this -> _toIp ( str_pad ( substr ( $ binaryHost , 0 , $ host [ 1 ] ) , 32 , 0 ) ) , 'broadcast' => ( int ) $ this -> _toIp ( str_pad ( substr ( $ binaryHost , 0 , $ host [ 1 ] ) , 32 , 1 ) ) ) ; for ( $ j = $ i ; $ j < 4 ; $ j ++ ) { if ( ( int ) $ octet [ $ j ] < $ segmentData [ 'network' ] [ $ j ] || ( int ) $ octet [ $ j ] > $ segmentData [ 'broadcast' ] [ $ j ] ) { return false ; } } } return true ; } else { return false ; } }
docstring: Returns if the given host is reserved
  
  @param string $host
  @return boolean
docstring_tokens: Returns if the given host is reserved