blob: 9dbb863215a4959c119439bf120d664ef94cbb14 (
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
<?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\Tracker\Visit;
use Piwik\Piwik;
use Piwik\Tracker\Visit;
use Piwik\Tracker\VisitInterface;
use Exception;
class Factory
{
/**
* Returns the Tracker_Visit object.
* This method can be overwritten to use a different Tracker_Visit object
*
* @throws Exception
* @return \Piwik\Tracker\Visit
*/
public static function make()
{
$visit = null;
/**
* Triggered before a new **visit tracking object** is created. Subscribers to this
* event can force the use of a custom visit tracking object that extends from
* {@link Piwik\Tracker\VisitInterface}.
*
* @param \Piwik\Tracker\VisitInterface &$visit Initialized to null, but can be set to
* a new visit object. If it isn't modified
* Piwik uses the default class.
*/
Piwik::postEvent('Tracker.makeNewVisitObject', array(&$visit));
if (!isset($visit)) {
$visit = new Visit();
} elseif (!($visit instanceof VisitInterface)) {
throw new Exception("The Visit object set in the plugin must implement VisitInterface");
}
return $visit;
}
}
|