/**
  * @param string $name the name of the instance
  * @param array  $options
  *
  * @return Instance
  */
 private static function parseInstance($name, $options)
 {
     $address = $options['address'];
     $port = intval($options['port']);
     $instance = new Instance($name, $address, $port);
     // Optionally set ignored users
     if (isset($options['ignoredUsers'])) {
         $instance->setIgnoredUsers($options['ignoredUsers']);
     }
     // Optionally set credentials
     if (isset($options['username']) && isset($options['password'])) {
         $instance->setCredentials($options['username'], $options['password']);
     }
     return $instance;
 }
 /**
  * @param ConfiguredInstance $instance
  *
  * @return bool whether the instance exists in the database
  */
 public function hasInstance(ConfiguredInstance $instance)
 {
     return $this->findPk($instance->getName()) !== null;
 }