original_string: public function registerShard($shard_name, $parameters)
      {
          if (empty($shard_name)) {
              throw new \Exception("The shard name is not specified!");
          }
          
          if (!empty($this->shard_table[$shard_name])) {
              throw new \Exception("The shard '$shard_name' has been already registered!");
          }
          
          $this->shard_table[$shard_name]["parameters"] = $parameters;
          
          return true;
      }
code: public function registerShard($shard_name, $parameters)
      {
          if (empty($shard_name)) {
              throw new \Exception("The shard name is not specified!");
          }
          
          if (!empty($this->shard_table[$shard_name])) {
              throw new \Exception("The shard '$shard_name' has been already registered!");
          }
          
          $this->shard_table[$shard_name]["parameters"] = $parameters;
          
          return true;
      }
code_tokens: public function registerShard ( $ shard_name , $ parameters ) { if ( empty ( $ shard_name ) ) { throw new \ Exception ( "The shard name is not specified!" ) ; } if ( ! empty ( $ this -> shard_table [ $ shard_name ] ) ) { throw new \ Exception ( "The shard '$shard_name' has been already registered!" ) ; } $ this -> shard_table [ $ shard_name ] [ "parameters" ] = $ parameters ; return true ; }
docstring: Registers a new shard.
  
  @param string $shard_name
  Unique shard name.
  
  @param array $parameters
  The connection parameters to the shard as an associative array in the form key => value:
  
  - $parameters["db_type"] - type of the database (MySQL or MSSQL)
  
  - $parameters["db_server"] - server address
  
  - $parameters["db_name"] - database name
  
  - $parameters["db_user"] - user name
  
  - $parameters["db_password"] - user password
  
  - $parameters["autoconnect"] - should true if the connection should be established automatically
  upon creation.
  
  - $parameters["read_only"] - this paramter sets the connection to the read only mode.
  
  @return boolean
  It should return true if the registering was successful, otherwise false.
  
  @throws \Exception
  It might throw an exception in the case of any errors:
  
  - if the shard name is not specified.
  - if the shard name has been already registered.
  
  @author Oleg Schildt
docstring_tokens: Registers a new shard .