Completed
Push — master ( 78b4bc...aee67f )
by Lorenzo
01:34
created

NetworkManager::getDeals()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 3
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