1<?php
2/**
3 * Matomo - free/libre analytics platform
4 *
5 * @link https://matomo.org
6 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
7 *
8 */
9namespace Piwik\Plugins\CoreHome\Columns;
10
11use Piwik\Columns\DimensionMetricFactory;
12use Piwik\Columns\MetricsList;
13use Piwik\Plugin\Dimension\VisitDimension;
14use Piwik\Metrics\Formatter;
15
16class VisitLastActionDayOfYear extends VisitDimension
17{
18    protected $columnName = 'visit_last_action_time';
19    protected $type = self::TYPE_DATETIME;
20    protected $segmentName = 'visitEndServerDayOfYear';
21    protected $nameSingular = 'VisitTime_ColumnVisitEndServerDayOfYear';
22    protected $sqlSegment = 'DAYOFYEAR(log_visit.visit_last_action_time)';
23    protected $acceptValues = '1, 2, 3, 4, ..., 365, 366';
24
25    public function __construct()
26    {
27        $this->suggestedValuesCallback = function ($idSite, $maxValuesToReturn) {
28            return range(1, min(366, $maxValuesToReturn));
29        };
30    }
31
32    public function configureMetrics(MetricsList $metricsList, DimensionMetricFactory $dimensionMetricFactory)
33    {
34        // no metrics for this dimension
35    }
36
37    public function formatValue($value, $idSite, Formatter $formatter)
38    {
39        return $value;
40    }
41}