Reports::get PHP Method

get() public method

public get ( $id )
    public function get($id)
    {
        if ($this->user->getClass() < User::CLASS_ADMIN) {
            throw new Exception(L::get("PERMISSION_DENIED"), 401);
        }
        $sth = $this->db->prepare("SELECT * FROM reports WHERE id = ?");
        $sth->bindParam(1, $id, PDO::PARAM_INT);
        $sth->execute();
        $report = $sth->fetch(PDO::FETCH_ASSOC);
        if (!$report) {
            throw new Exception(L::get("REPORTS_NOT_FOUND"), 404);
        }
        return $report;
    }