Grav\Plugin\Admin\Popularity::updateTotals PHP Method

updateTotals() protected method

protected updateTotals ( string $url )
$url string
    protected function updateTotals($url)
    {
        if (!$this->totals_data) {
            $this->totals_data = $this->getData($this->totals_file);
        }
        // get the totals for this url
        if (array_key_exists($url, $this->totals_data)) {
            $this->totals_data[$url] = intval($this->totals_data[$url]) + 1;
        } else {
            $this->totals_data[$url] = 1;
        }
        file_put_contents($this->totals_file, json_encode($this->totals_data));
    }