original_string: private static function handleFilter(String &$sql, $filter, LightModel $class): array
      {
          $params = [];
  
          if (isset($filter[self::FILTER_ORDER]))
          {
              $order = $filter[self::FILTER_ORDER];
              unset($filter[self::FILTER_ORDER]);
          }
  
          if (isset($filter[self::FILTER_LIMIT]))
          {
              $limit = (int) $filter[self::FILTER_LIMIT];
              unset($filter[self::FILTER_LIMIT]);
          }
  
          foreach ($filter as $filter => $value)
          {
              if (! $class->getTable()->hasColumn($filter))
                  continue;
  
              //Default operator for all queries
              $operator = '=';
  
              //Check if the operator was passed in
              if (is_array($value))
              {
                  $operator = $value[0];
                  $value = $value[1];
              }
  
              switch ($class->getTable()->getColumn($filter)->getType())
              {
                  case Column::TYPE_INT:
                      $value = (int) $value;
                      break;
                  default:
                      $value = (string) $value;
              }
  
              $sql .= ' AND `' . $filter . '` ' . $operator . ' :' . $filter;
              $params[':' . $filter] = $value;
          }
  
          if (isset($order))
          {
              $sql .= ' ORDER BY ' . $order;
          }
  
          if (isset($limit))
          {
              $sql .= ' LIMIT ' . $limit;
          }
  
          return $params;
      }
code: private static function handleFilter(String &$sql, $filter, LightModel $class): array
      {
          $params = [];
  
          if (isset($filter[self::FILTER_ORDER]))
          {
              $order = $filter[self::FILTER_ORDER];
              unset($filter[self::FILTER_ORDER]);
          }
  
          if (isset($filter[self::FILTER_LIMIT]))
          {
              $limit = (int) $filter[self::FILTER_LIMIT];
              unset($filter[self::FILTER_LIMIT]);
          }
  
          foreach ($filter as $filter => $value)
          {
              if (! $class->getTable()->hasColumn($filter))
                  continue;
  
              //Default operator for all queries
              $operator = '=';
  
              //Check if the operator was passed in
              if (is_array($value))
              {
                  $operator = $value[0];
                  $value = $value[1];
              }
  
              switch ($class->getTable()->getColumn($filter)->getType())
              {
                  case Column::TYPE_INT:
                      $value = (int) $value;
                      break;
                  default:
                      $value = (string) $value;
              }
  
              $sql .= ' AND `' . $filter . '` ' . $operator . ' :' . $filter;
              $params[':' . $filter] = $value;
          }
  
          if (isset($order))
          {
              $sql .= ' ORDER BY ' . $order;
          }
  
          if (isset($limit))
          {
              $sql .= ' LIMIT ' . $limit;
          }
  
          return $params;
      }
code_tokens: private static function handleFilter ( String & $ sql , $ filter , LightModel $ class ) : array { $ params = [ ] ; if ( isset ( $ filter [ self :: FILTER_ORDER ] ) ) { $ order = $ filter [ self :: FILTER_ORDER ] ; unset ( $ filter [ self :: FILTER_ORDER ] ) ; } if ( isset ( $ filter [ self :: FILTER_LIMIT ] ) ) { $ limit = ( int ) $ filter [ self :: FILTER_LIMIT ] ; unset ( $ filter [ self :: FILTER_LIMIT ] ) ; } foreach ( $ filter as $ filter => $ value ) { if ( ! $ class -> getTable ( ) -> hasColumn ( $ filter ) ) continue ; //Default operator for all queries $ operator = '=' ; //Check if the operator was passed in if ( is_array ( $ value ) ) { $ operator = $ value [ 0 ] ; $ value = $ value [ 1 ] ; } switch ( $ class -> getTable ( ) -> getColumn ( $ filter ) -> getType ( ) ) { case Column :: TYPE_INT : $ value = ( int ) $ value ; break ; default : $ value = ( string ) $ value ; } $ sql .= ' AND `' . $ filter . '` ' . $ operator . ' :' . $ filter ; $ params [ ':' . $ filter ] = $ value ; } if ( isset ( $ order ) ) { $ sql .= ' ORDER BY ' . $ order ; } if ( isset ( $ limit ) ) { $ sql .= ' LIMIT ' . $ limit ; } return $ params ; }
docstring: Parse filters & return the associated params for passing into PDO query
  
  @param String $sql
  @param $filter
  @param LightModel $class
  @return array
docstring_tokens: Parse filters & return the associated params for passing into PDO query