1 | <?php |
||
13 | class Mautic |
||
14 | { |
||
15 | /** |
||
16 | * Mautic base (root) URL |
||
17 | * |
||
18 | * @var string |
||
19 | */ |
||
20 | protected $baseUrl; |
||
21 | |||
22 | /** |
||
23 | * Mautic Contact |
||
24 | * |
||
25 | * @var Contact |
||
26 | */ |
||
27 | protected $contact; |
||
28 | |||
29 | /** |
||
30 | * Mautic Contact Cookie |
||
31 | * |
||
32 | * @var MauticCookie |
||
33 | */ |
||
34 | protected $cookie; |
||
35 | |||
36 | /** |
||
37 | * Mautic Configuration |
||
38 | * |
||
39 | * @var Config |
||
40 | 26 | */ |
|
41 | protected $config; |
||
42 | 26 | ||
43 | 26 | /** |
|
44 | 26 | * Constructor |
|
45 | 26 | * |
|
46 | * @param string $baseUrl |
||
47 | */ |
||
48 | public function __construct($baseUrl, Config $config = null) |
||
49 | { |
||
50 | $this->baseUrl = rtrim(trim($baseUrl), '/'); |
||
51 | $this->cookie = new MauticCookie; |
||
52 | 6 | $this->contact = new Contact($this->cookie); |
|
53 | $this->config = $config ?: new Config; |
||
54 | 6 | } |
|
55 | |||
56 | /** |
||
57 | * Returns Mautic's base URL |
||
58 | * |
||
59 | * @return string |
||
60 | */ |
||
61 | public function getBaseUrl() |
||
65 | |||
66 | 10 | /** |
|
67 | * Returns new Mautic Form representation object |
||
68 | * |
||
69 | * @param int $id |
||
70 | * |
||
71 | * @return Form |
||
72 | */ |
||
73 | public function getForm($id) |
||
77 | |||
78 | 2 | /** |
|
79 | * Sets the Mautic Contact if you want to replace the default one |
||
80 | 2 | * |
|
81 | * @param Contact $contact |
||
82 | * |
||
83 | * @return Mautic |
||
84 | */ |
||
85 | public function setContact(Contact $contact) |
||
91 | |||
92 | /** |
||
93 | * Returns Mautic Contact representation object |
||
94 | * |
||
95 | * @return Contact |
||
96 | */ |
||
97 | public function getContact() |
||
101 | |||
102 | /** |
||
103 | * Returns Mautic Cookie representation object |
||
104 | * |
||
105 | * @return MauticCookie |
||
106 | */ |
||
107 | public function getCookie() |
||
111 | |||
112 | /** |
||
113 | * Returns Mautic Configuration representation object |
||
114 | * |
||
115 | * @return Config |
||
116 | */ |
||
117 | public function getConfig() |
||
121 | } |
||
122 |