original_string: public function is_connection_ready() {
          if (!@$this->connection->set("ping", 'ping', 1)) {
              // Test the connection to the server.
              return false;
          }
  
          if ($this->isshared) {
              // There is a bug in libmemcached which means that it is not possible to purge the cache in a shared cache
              // configuration.
              // This issue currently affects:
              // - memcached 1.4.23+ with php-memcached <= 2.2.0
              // The following combinations are not affected:
              // - memcached <= 1.4.22 with any version of php-memcached
              // - any version of memcached with php-memcached >= 3.0.1
  
  
              // This check is cheapest as it does not involve connecting to the server at all.
              $safecombination = false;
              $extension = new ReflectionExtension('memcached');
              if ((version_compare($extension->getVersion(), '3.0.1') >= 0)) {
                  // This is php-memcached version >= 3.0.1 which is a safe combination.
                  $safecombination = true;
              }
  
              if (!$safecombination) {
                  $allsafe = true;
                  foreach ($this->connection->getVersion() as $version) {
                      $allsafe = $allsafe && (version_compare($version, '1.4.22') <= 0);
                  }
                  // All memcached servers connected are version <= 1.4.22 which is a safe combination.
                  $safecombination = $allsafe;
              }
  
              if (!$safecombination) {
                  // This is memcached 1.4.23+ and php-memcached < 3.0.1.
                  // The issue may have been resolved in a subsequent update to any of the three libraries.
                  // The only way to safely determine if the combination is safe is to call getAllKeys.
                  // A safe combination will return an array, whilst an affected combination will return false.
                  // This is the most expensive check.
                  if (!is_array($this->connection->getAllKeys())) {
                      return false;
                  }
              }
          }
  
          return true;
      }
code: public function is_connection_ready() {
          if (!@$this->connection->set("ping", 'ping', 1)) {
              // Test the connection to the server.
              return false;
          }
  
          if ($this->isshared) {
              // There is a bug in libmemcached which means that it is not possible to purge the cache in a shared cache
              // configuration.
              // This issue currently affects:
              // - memcached 1.4.23+ with php-memcached <= 2.2.0
              // The following combinations are not affected:
              // - memcached <= 1.4.22 with any version of php-memcached
              // - any version of memcached with php-memcached >= 3.0.1
  
  
              // This check is cheapest as it does not involve connecting to the server at all.
              $safecombination = false;
              $extension = new ReflectionExtension('memcached');
              if ((version_compare($extension->getVersion(), '3.0.1') >= 0)) {
                  // This is php-memcached version >= 3.0.1 which is a safe combination.
                  $safecombination = true;
              }
  
              if (!$safecombination) {
                  $allsafe = true;
                  foreach ($this->connection->getVersion() as $version) {
                      $allsafe = $allsafe && (version_compare($version, '1.4.22') <= 0);
                  }
                  // All memcached servers connected are version <= 1.4.22 which is a safe combination.
                  $safecombination = $allsafe;
              }
  
              if (!$safecombination) {
                  // This is memcached 1.4.23+ and php-memcached < 3.0.1.
                  // The issue may have been resolved in a subsequent update to any of the three libraries.
                  // The only way to safely determine if the combination is safe is to call getAllKeys.
                  // A safe combination will return an array, whilst an affected combination will return false.
                  // This is the most expensive check.
                  if (!is_array($this->connection->getAllKeys())) {
                      return false;
                  }
              }
          }
  
          return true;
      }
code_tokens: public function is_connection_ready ( ) { if ( ! @ $ this -> connection -> set ( "ping" , 'ping' , 1 ) ) { // Test the connection to the server. return false ; } if ( $ this -> isshared ) { // There is a bug in libmemcached which means that it is not possible to purge the cache in a shared cache // configuration. // This issue currently affects: // - memcached 1.4.23+ with php-memcached <= 2.2.0 // The following combinations are not affected: // - memcached <= 1.4.22 with any version of php-memcached // - any version of memcached with php-memcached >= 3.0.1 // This check is cheapest as it does not involve connecting to the server at all. $ safecombination = false ; $ extension = new ReflectionExtension ( 'memcached' ) ; if ( ( version_compare ( $ extension -> getVersion ( ) , '3.0.1' ) >= 0 ) ) { // This is php-memcached version >= 3.0.1 which is a safe combination. $ safecombination = true ; } if ( ! $ safecombination ) { $ allsafe = true ; foreach ( $ this -> connection -> getVersion ( ) as $ version ) { $ allsafe = $ allsafe && ( version_compare ( $ version , '1.4.22' ) <= 0 ) ; } // All memcached servers connected are version <= 1.4.22 which is a safe combination. $ safecombination = $ allsafe ; } if ( ! $ safecombination ) { // This is memcached 1.4.23+ and php-memcached < 3.0.1. // The issue may have been resolved in a subsequent update to any of the three libraries. // The only way to safely determine if the combination is safe is to call getAllKeys. // A safe combination will return an array, whilst an affected combination will return false. // This is the most expensive check. if ( ! is_array ( $ this -> connection -> getAllKeys ( ) ) ) { return false ; } } } return true ; }
docstring: Confirm whether the connection is ready and usable.
  
  @return boolean
docstring_tokens: Confirm whether the connection is ready and usable .