-
Notifications
You must be signed in to change notification settings - Fork 0
/
UniSender.php
127 lines (111 loc) · 2.67 KB
/
UniSender.php
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<?php
namespace omgdef\yii\unisender;
use yii\base\Component;
use omgdef\unisender\UniSenderWrapper;
class UniSender extends Component
{
protected $obj;
/**
* @inheritdoc
*/
public function __construct($config = [])
{
$this->obj = new UniSenderWrapper();
foreach ($config as $name => $value) {
$this->obj->$name = $value;
}
$this->init();
}
/**
* @inheritdoc
*/
public function __get($name)
{
if (property_exists($this->obj, $name)) {
return $this->obj->$name;
}
return parent::__get($name);
}
/**
* @inheritdoc
*/
public function __set($name, $value)
{
if (property_exists($this->obj, $name)) {
$this->obj->$name = $value;
return;
}
parent::__set($name, $value);
}
/**
* @inheritdoc
*/
public function __isset($name)
{
if (property_exists($this->obj, $name)) {
return $this->obj->$name !== null;
}
return parent::__isset($name);
}
/**
* @inheritdoc
*/
public function __unset($name)
{
if (property_exists($this->obj, $name)) {
$this->obj->$name = null;
return;
}
parent::__unset($name);
}
/**
* @inheritdoc
*/
public function __call($name, $params)
{
if (method_exists($this->obj, $name)) {
return call_user_func_array([$this->obj, $name], $params);
}
return parent::__call($name, $params);
}
/**
* @inheritdoc
*/
public function hasProperty($name, $checkVars = true, $checkBehaviors = true)
{
if (property_exists($this->obj, $name)) {
return true;
}
return parent::hasProperty($name, $checkVars, $checkBehaviors);
}
/**
* @inheritdoc
*/
public function canGetProperty($name, $checkVars = true, $checkBehaviors = true)
{
if (property_exists($this->obj, $name)) {
return true;
}
return parent::canGetProperty($name, $checkVars, $checkBehaviors);
}
/**
* @inheritdoc
*/
public function canSetProperty($name, $checkVars = true, $checkBehaviors = true)
{
if (property_exists($this->obj, $name)) {
return true;
}
return parent::canSetProperty($name, $checkVars, $checkBehaviors);
}
/**
* @inheritdoc
*/
public function hasMethod($name, $checkBehaviors = true)
{
if (method_exists($this->obj, $name)) {
return true;
}
return parent::hasMethod($name, $checkBehaviors);
}
}