<?php

class KPIStats extends Core {

    function list() {

        $company_id = $_GET['companyId'];
        $sql = "SELECT `count` as total, key_string FROM kpi_stats WHERE company_id = :company_id AND key_string <> '' ORDER BY total DESC";

        $stmt = parent::$conn->prepare($sql);
        $stmt->execute([':company_id' => $company_id]);
        $result = $stmt->fetchAll(PDO::FETCH_ASSOC);

        return $result;

    }    

}