1
|
|
|
<?php namespace Arcanedev\LaravelTracker; |
2
|
|
|
|
3
|
|
|
use Arcanedev\LaravelTracker\Contracts\Tracker as TrackerContract; |
4
|
|
|
use Arcanedev\LaravelTracker\Contracts\TrackingManager as TrackingManagerContract; |
5
|
|
|
use Illuminate\Contracts\Foundation\Application; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Class Tracker |
9
|
|
|
* |
10
|
|
|
* @package Arcanedev\LaravelTracker |
11
|
|
|
* @author ARCANEDEV <[email protected]> |
12
|
|
|
*/ |
13
|
|
|
class Tracker implements TrackerContract |
14
|
|
|
{ |
15
|
|
|
/* ------------------------------------------------------------------------------------------------ |
16
|
|
|
| Properties |
17
|
|
|
| ------------------------------------------------------------------------------------------------ |
18
|
|
|
*/ |
19
|
|
|
/** |
20
|
|
|
* The application container. |
21
|
|
|
* |
22
|
|
|
* @var \Illuminate\Contracts\Foundation\Application |
23
|
|
|
*/ |
24
|
|
|
protected $app; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* The tracking manager. |
28
|
|
|
* |
29
|
|
|
* @var \Arcanedev\LaravelTracker\Contracts\TrackingManager |
30
|
|
|
*/ |
31
|
|
|
private $manager; |
32
|
|
|
|
33
|
|
|
/* ------------------------------------------------------------------------------------------------ |
34
|
|
|
| Constructor |
35
|
|
|
| ------------------------------------------------------------------------------------------------ |
36
|
|
|
*/ |
37
|
|
|
/** |
38
|
|
|
* Tracker constructor. |
39
|
|
|
* |
40
|
|
|
* @param \Illuminate\Contracts\Foundation\Application $app |
41
|
|
|
* @param \Arcanedev\LaravelTracker\Contracts\TrackingManager $manager |
42
|
|
|
*/ |
43
|
24 |
|
public function __construct(Application $app, TrackingManagerContract $manager) |
44
|
|
|
{ |
45
|
24 |
|
$this->app = $app; |
46
|
24 |
|
$this->manager = $manager; |
47
|
24 |
|
} |
48
|
|
|
|
49
|
|
|
/* ------------------------------------------------------------------------------------------------ |
50
|
|
|
| Getters & Setters |
51
|
|
|
| ------------------------------------------------------------------------------------------------ |
52
|
|
|
*/ |
53
|
|
|
|
54
|
|
|
/* ------------------------------------------------------------------------------------------------ |
55
|
|
|
| Main Functions |
56
|
|
|
| ------------------------------------------------------------------------------------------------ |
57
|
|
|
*/ |
58
|
|
|
/** |
59
|
|
|
* Enable the tracking. |
60
|
|
|
*/ |
61
|
6 |
|
public function enable() |
62
|
|
|
{ |
63
|
6 |
|
$this->manager->enable(); |
64
|
6 |
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* Disable the tracking. |
68
|
|
|
*/ |
69
|
6 |
|
public function disable() |
70
|
|
|
{ |
71
|
6 |
|
$this->manager->disable(); |
72
|
6 |
|
} |
73
|
|
|
|
74
|
|
|
/* ------------------------------------------------------------------------------------------------ |
75
|
|
|
| Check Functions |
76
|
|
|
| ------------------------------------------------------------------------------------------------ |
77
|
|
|
*/ |
78
|
|
|
/** |
79
|
|
|
* Check if the tracking is enabled. |
80
|
|
|
* |
81
|
|
|
* @return bool |
82
|
|
|
*/ |
83
|
18 |
|
public function isEnabled() |
84
|
|
|
{ |
85
|
18 |
|
return $this->manager->isEnabled(); |
86
|
|
|
} |
87
|
|
|
} |
88
|
|
|
|