original_string: public static function count($filter = []): int
      {
          /* @var $class LightModel */
          $className = get_called_class();
          $class = new $className;
          $tableKey = $class->getKeyName();
  
          $sql = 'SELECT COUNT(' . $tableKey . ') FROM ' . $class->getTableName() . ' WHERE 1=1';
          $params = self::handleFilter($sql, $filter, $class);
  
          $query = DB::getConnection()->prepare($sql);
          $query->execute($params);
  
          return (int) $query->fetchColumn(0);
      }
code: public static function count($filter = []): int
      {
          /* @var $class LightModel */
          $className = get_called_class();
          $class = new $className;
          $tableKey = $class->getKeyName();
  
          $sql = 'SELECT COUNT(' . $tableKey . ') FROM ' . $class->getTableName() . ' WHERE 1=1';
          $params = self::handleFilter($sql, $filter, $class);
  
          $query = DB::getConnection()->prepare($sql);
          $query->execute($params);
  
          return (int) $query->fetchColumn(0);
      }
code_tokens: public static function count ( $ filter = [ ] ) : int { /* @var $class LightModel */ $ className = get_called_class ( ) ; $ class = new $ className ; $ tableKey = $ class -> getKeyName ( ) ; $ sql = 'SELECT COUNT(' . $ tableKey . ') FROM ' . $ class -> getTableName ( ) . ' WHERE 1=1' ; $ params = self :: handleFilter ( $ sql , $ filter , $ class ) ; $ query = DB :: getConnection ( ) -> prepare ( $ sql ) ; $ query -> execute ( $ params ) ; return ( int ) $ query -> fetchColumn ( 0 ) ; }
docstring: Count items based on filter
  
  @param array $filter
  @return int
docstring_tokens: Count items based on filter