Welcome to mirror list, hosted at ThFree Co, Russian Federation.

VisitsDataSubject.php « Validators « PrivacyManager « plugins - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: bf76f058b8e6e164b063b9c60e7fd3944d5ee1db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
/**
 * Piwik - free/libre analytics platform
 *
 * @link http://piwik.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */

namespace Piwik\Plugins\PrivacyManager\Validators;

use Piwik\Validators\BaseValidator;
use Piwik\Validators\Exception;

class VisitsDataSubject extends BaseValidator
{
    public function validate($visits)
    {
        if (empty($visits) || !is_array($visits)) {
            throw new Exception('No list of visits given');
        }

        foreach ($visits as $index => $visit) {
            if (empty($visit['idsite'])) {
                throw new Exception('No idsite key set for visit at index ' . $index);
            }
            if (empty($visit['idvisit'])) {
                throw new Exception('No idvisit key set for visit at index ' . $index);
            }
        }
    }

}