original_string: public function dbshard($shard_name)
      {
          if (empty($shard_name) || empty($this->shard_table[$shard_name])) {
              throw new \Exception("The shard '$shard_name' was not found!");
              return null;
          }
          
          if (empty($this->shard_table[$shard_name]["dbworker"])) {
              $this->shard_table[$shard_name]["dbworker"] = dbworker($this->shard_table[$shard_name]["parameters"], true);
          }
          
          return $this->shard_table[$shard_name]["dbworker"];
      }
code: public function dbshard($shard_name)
      {
          if (empty($shard_name) || empty($this->shard_table[$shard_name])) {
              throw new \Exception("The shard '$shard_name' was not found!");
              return null;
          }
          
          if (empty($this->shard_table[$shard_name]["dbworker"])) {
              $this->shard_table[$shard_name]["dbworker"] = dbworker($this->shard_table[$shard_name]["parameters"], true);
          }
          
          return $this->shard_table[$shard_name]["dbworker"];
      }
code_tokens: public function dbshard ( $ shard_name ) { if ( empty ( $ shard_name ) || empty ( $ this -> shard_table [ $ shard_name ] ) ) { throw new \ Exception ( "The shard '$shard_name' was not found!" ) ; return null ; } if ( empty ( $ this -> shard_table [ $ shard_name ] [ "dbworker" ] ) ) { $ this -> shard_table [ $ shard_name ] [ "dbworker" ] = dbworker ( $ this -> shard_table [ $ shard_name ] [ "parameters" ] , true ) ; } return $ this -> shard_table [ $ shard_name ] [ "dbworker" ] ; }
docstring: The method dbshard provides the DBWorker object for working with the shard.
  
  If the parameters are omitted, the system takes the parameters from the configuration
  settings and reuses the single instance of the DBWorker for all requests.
  If the user passes the parameters explicitly, a new instance of the DBWorker is created upon each new request.
  
  Currently supported: MySQL und MS SQL.
  
  @param string $shard_name
  The name of the shard.
  
  @return \SmartFactory\DatabaseWorkers\DBWorker|null
  returns DBWorker object or null if the object could not be created.
  
  @throws \Exception
  It might throw an exception in the case of any errors:
  
  - if the interface or class does not exist.
  - if the shard was not found.
  - if the check of the classes and interfaces fails.
  - if the php extension is not installed.
  - db_missing_type_error - if the database type is not specified.
  - db_conn_data_error - if the connection parameters are incomplete.
  - db_server_conn_error - if the database server cannot be connected.
  - db_not_exists_error - if database does not exists od inaccesible to the user.
  
  @author Oleg Schildt
docstring_tokens: The method dbshard provides the DBWorker object for working with the shard .