original_string: public function getData(DbManagement $db, $query, $params, DbManagementObject $DbManagementObject)
      {       
          $keys = $DbManagementObject->getKeys();
  
          //parse params to check their validity and 
          //use the conventions to sort and filter results
          $parsed = $this->parseParams($params, $keys, $DbManagementObject->getTypes());
          
          $array=[];
  
          //if valid params have been detected
          //query is filled in with arguments
          if(isset($parsed)){
              foreach ($parsed as $type => $values) {
                  switch($type){
                      case "min":
                          foreach ($values as $key => $val) {
                              $min = $keys[$key]."-min";
                              $db->sortMin($query,$keys[$key],$min);
                              $array[]=$val;
                          }
                          break;
                      case "max":
                          foreach ($values as $key => $val) {
                              $max = $keys[$key]."-max";
                              $db->sortMax($query,$keys[$key],$max);
                              $array[]=$val;
                          }
                          break;
                      case "up":
                          foreach ($values as $val) {
                              $db->orderUp($query,$keys[$val]);
                          }
                          break;
                      case "down":
                          foreach ($values as $val) {
                              $db->orderDown($query,$keys[$val]);
                          }
                          break;
                      case "equals":
                          foreach ($values as $key => $val) {
                              $db->sort($query,$keys[$key], $keys[$key]);
                              $array[]=$val;
                          }
                          break;
                  }
              }
          }
  
          //close query
          $db->closeQuery($query);
  
          $answer = $db->query($query, $array);
  
          $args=[];
          while ($row = $answer->fetch(\PDO::FETCH_ASSOC)) {
              foreach ($keys as $key => $val) {
                  $argsDbManagementObject[$val]=$row[$val];
              }
              $args[] = $argsDbManagementObject;
          }
  
          return $args;
      }
code: public function getData(DbManagement $db, $query, $params, DbManagementObject $DbManagementObject)
      {       
          $keys = $DbManagementObject->getKeys();
  
          //parse params to check their validity and 
          //use the conventions to sort and filter results
          $parsed = $this->parseParams($params, $keys, $DbManagementObject->getTypes());
          
          $array=[];
  
          //if valid params have been detected
          //query is filled in with arguments
          if(isset($parsed)){
              foreach ($parsed as $type => $values) {
                  switch($type){
                      case "min":
                          foreach ($values as $key => $val) {
                              $min = $keys[$key]."-min";
                              $db->sortMin($query,$keys[$key],$min);
                              $array[]=$val;
                          }
                          break;
                      case "max":
                          foreach ($values as $key => $val) {
                              $max = $keys[$key]."-max";
                              $db->sortMax($query,$keys[$key],$max);
                              $array[]=$val;
                          }
                          break;
                      case "up":
                          foreach ($values as $val) {
                              $db->orderUp($query,$keys[$val]);
                          }
                          break;
                      case "down":
                          foreach ($values as $val) {
                              $db->orderDown($query,$keys[$val]);
                          }
                          break;
                      case "equals":
                          foreach ($values as $key => $val) {
                              $db->sort($query,$keys[$key], $keys[$key]);
                              $array[]=$val;
                          }
                          break;
                  }
              }
          }
  
          //close query
          $db->closeQuery($query);
  
          $answer = $db->query($query, $array);
  
          $args=[];
          while ($row = $answer->fetch(\PDO::FETCH_ASSOC)) {
              foreach ($keys as $key => $val) {
                  $argsDbManagementObject[$val]=$row[$val];
              }
              $args[] = $argsDbManagementObject;
          }
  
          return $args;
      }
code_tokens: public function getData ( DbManagement $ db , $ query , $ params , DbManagementObject $ DbManagementObject ) { $ keys = $ DbManagementObject -> getKeys ( ) ; //parse params to check their validity and  //use the conventions to sort and filter results $ parsed = $ this -> parseParams ( $ params , $ keys , $ DbManagementObject -> getTypes ( ) ) ; $ array = [ ] ; //if valid params have been detected //query is filled in with arguments if ( isset ( $ parsed ) ) { foreach ( $ parsed as $ type => $ values ) { switch ( $ type ) { case "min" : foreach ( $ values as $ key => $ val ) { $ min = $ keys [ $ key ] . "-min" ; $ db -> sortMin ( $ query , $ keys [ $ key ] , $ min ) ; $ array [ ] = $ val ; } break ; case "max" : foreach ( $ values as $ key => $ val ) { $ max = $ keys [ $ key ] . "-max" ; $ db -> sortMax ( $ query , $ keys [ $ key ] , $ max ) ; $ array [ ] = $ val ; } break ; case "up" : foreach ( $ values as $ val ) { $ db -> orderUp ( $ query , $ keys [ $ val ] ) ; } break ; case "down" : foreach ( $ values as $ val ) { $ db -> orderDown ( $ query , $ keys [ $ val ] ) ; } break ; case "equals" : foreach ( $ values as $ key => $ val ) { $ db -> sort ( $ query , $ keys [ $ key ] , $ keys [ $ key ] ) ; $ array [ ] = $ val ; } break ; } } } //close query $ db -> closeQuery ( $ query ) ; $ answer = $ db -> query ( $ query , $ array ) ; $ args = [ ] ; while ( $ row = $ answer -> fetch ( \ PDO :: FETCH_ASSOC ) ) { foreach ( $ keys as $ key => $ val ) { $ argsDbManagementObject [ $ val ] = $ row [ $ val ] ; } $ args [ ] = $ argsDbManagementObject ; } return $ args ; }
docstring: get data from the table in the database according to the params and the expected DbManagementObject
  @param DbManagement $db                          the database connector
  @param String $query                             the query to select data in database
  @param array $params                             parameters for the query to indicate filters or sorting
  @param DbManagementObject $DbManagementObject    the DbManagementObject for which data are expected
  @throws DataBaseException                        error in connecting to the database
  @return mixed array containing key/value pair defining a DbManagementObject
docstring_tokens: get data from the table in the database according to the params and the expected DbManagementObject