|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Padosoft\AffiliateNetwork; |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* Class NetworkManager |
|
7
|
|
|
* @package Padosoft\AffiliateNetwork |
|
8
|
|
|
*/ |
|
9
|
|
|
class NetworkManager |
|
10
|
|
|
{ |
|
11
|
|
|
/** |
|
12
|
|
|
* Network/api |
|
13
|
|
|
* @var NetworkInterface |
|
14
|
|
|
*/ |
|
15
|
|
|
protected $network; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* Register the dependencies |
|
19
|
|
|
* @param NetworkInterface $network |
|
20
|
|
|
*/ |
|
21
|
|
|
public function __construct(NetworkInterface $network) |
|
22
|
|
|
{ |
|
23
|
|
|
$this->setNetwork($network); |
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* Set the network / api to use |
|
28
|
|
|
* @param NetworkInterface $network |
|
29
|
|
|
*/ |
|
30
|
|
|
public function setNetwork(NetworkInterface $network) |
|
31
|
|
|
{ |
|
32
|
|
|
$this->network = $network; |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* Get the network |
|
37
|
|
|
* @return NetworkInterface |
|
38
|
|
|
*/ |
|
39
|
|
|
public function getNetwork() |
|
40
|
|
|
{ |
|
41
|
|
|
return $this->network; |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* @param \DateTime $dateFrom |
|
46
|
|
|
* @param \DateTime $dateTo |
|
47
|
|
|
* @param int $merchantID |
|
48
|
|
|
* @return array of Deal |
|
49
|
|
|
*/ |
|
50
|
|
|
public function getDeals(\DateTime $dateFrom, \DateTime $dateTo, int $merchantID = 0) : array |
|
51
|
|
|
{ |
|
52
|
|
|
return $this->network->getDeals($dateFrom, $dateTo, $merchantID); |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* @param \DateTime $dateFrom |
|
57
|
|
|
* @param \DateTime $dateTo |
|
58
|
|
|
* @param int $merchantID |
|
59
|
|
|
* @return array of Transaction |
|
60
|
|
|
*/ |
|
61
|
|
|
public function getSales(\DateTime $dateFrom, \DateTime $dateTo, int $merchantID = 0) : array |
|
62
|
|
|
{ |
|
63
|
|
|
return $this->network->getSales($dateFrom, $dateTo, $merchantID); |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* @param \DateTime $dateFrom |
|
68
|
|
|
* @param \DateTime $dateTo |
|
69
|
|
|
* @param int $merchantID |
|
70
|
|
|
* @return array of Stat |
|
71
|
|
|
*/ |
|
72
|
|
|
public function getStats(\DateTime $dateFrom, \DateTime $dateTo, int $merchantID = 0) : array |
|
73
|
|
|
{ |
|
74
|
|
|
return $this->network->getStats($dateFrom, $dateTo, $merchantID); |
|
75
|
|
|
} |
|
76
|
|
|
} |
|
77
|
|
|
|