PHP Classes

File: src/Stats.php

Recommend this page to a friend!
  Classes of Joseluis Laso   PHP Stats Graphs   src/Stats.php   Download  
File: src/Stats.php
Role: Class source
Content type: text/plain
Description: Class source
Class: PHP Stats Graphs
Generate SVG charts from sample data
Author: By
Last change:
Date: 7 years ago
Size: 676 bytes
 

Contents

Class file image Download
<?php

namespace JLaso\SimpleStats;

class
Stats extends StatsBase
{
    protected static
$instance;

   
/**
     * Stats constructor.
     */
   
public function __construct()
    {
       
parent::__construct();
    }

   
/**
     * @return Stats
     */
   
public static function getInstance()
    {
        if(!
self::$instance){
           
self::$instance = new Stats();
        }

        return
self::$instance;
    }

    public function
insert($event, $data)
    {
        if (!
$model = $this->getModel($event)) {
            throw new \
Exception("Event {$event} does not have a model associated !");
        }
       
$this->db->insertData($model, $data);
    }
}