Passed
Push — master ( a3cc07...eb52df )
by Nashwan
03:50
created

Donor::__wakeup()   A

Complexity

Conditions 4
Paths 2

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 8
nc 2
nop 0
dl 0
loc 12
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace EBloodBank\Proxies\__CG__\EBloodBank\Models;
4
5
/**
6
 * DO NOT EDIT THIS FILE - IT WAS CREATED BY DOCTRINE'S PROXY GENERATOR
7
 */
8
class Donor extends \EBloodBank\Models\Donor implements \Doctrine\ORM\Proxy\Proxy
9
{
10
    /**
11
     * @var \Closure the callback responsible for loading properties in the proxy object. This callback is called with
12
     *      three parameters, being respectively the proxy object to be initialized, the method that triggered the
13
     *      initialization process and an array of ordered parameters that were passed to that method.
14
     *
15
     * @see \Doctrine\Common\Persistence\Proxy::__setInitializer
16
     */
17
    public $__initializer__;
18
19
    /**
20
     * @var \Closure the callback responsible of loading properties that need to be copied in the cloned object
21
     *
22
     * @see \Doctrine\Common\Persistence\Proxy::__setCloner
23
     */
24
    public $__cloner__;
25
26
    /**
27
     * @var boolean flag indicating if this object was already initialized
28
     *
29
     * @see \Doctrine\Common\Persistence\Proxy::__isInitialized
30
     */
31
    public $__isInitialized__ = false;
32
33
    /**
34
     * @var array properties to be lazy loaded, with keys being the property
35
     *            names and values being their default values
36
     *
37
     * @see \Doctrine\Common\Persistence\Proxy::__getLazyProperties
38
     */
39
    public static $lazyPropertiesDefaults = [];
40
41
42
43
    /**
44
     * @param \Closure $initializer
45
     * @param \Closure $cloner
46
     */
47
    public function __construct($initializer = null, $cloner = null)
48
    {
49
50
        $this->__initializer__ = $initializer;
51
        $this->__cloner__      = $cloner;
52
    }
53
54
55
56
57
58
59
60
    /**
61
     * 
62
     * @return array
63
     */
64
    public function __sleep()
65
    {
66
        if ($this->__isInitialized__) {
67
            return ['__isInitialized__', 'id', 'name', 'gender', 'birthdate', 'blood_group', 'district', 'created_at', 'created_by', 'status', 'meta'];
68
        }
69
70
        return ['__isInitialized__', 'id', 'name', 'gender', 'birthdate', 'blood_group', 'district', 'created_at', 'created_by', 'status', 'meta'];
71
    }
72
73
    /**
74
     * 
75
     */
76
    public function __wakeup()
77
    {
78
        if ( ! $this->__isInitialized__) {
79
            $this->__initializer__ = function (Donor $proxy) {
80
                $proxy->__setInitializer(null);
81
                $proxy->__setCloner(null);
82
83
                $existingProperties = get_object_vars($proxy);
84
85
                foreach ($proxy->__getLazyProperties() as $property => $defaultValue) {
86
                    if ( ! array_key_exists($property, $existingProperties)) {
87
                        $proxy->$property = $defaultValue;
88
                    }
89
                }
90
            };
91
92
        }
93
    }
94
95
    /**
96
     * 
97
     */
98
    public function __clone()
99
    {
100
        $this->__cloner__ && $this->__cloner__->__invoke($this, '__clone', []);
101
    }
102
103
    /**
104
     * Forces initialization of the proxy
105
     */
106
    public function __load()
107
    {
108
        $this->__initializer__ && $this->__initializer__->__invoke($this, '__load', []);
109
    }
110
111
    /**
112
     * {@inheritDoc}
113
     * @internal generated method: use only when explicitly handling proxy specific loading logic
114
     */
115
    public function __isInitialized()
116
    {
117
        return $this->__isInitialized__;
118
    }
119
120
    /**
121
     * {@inheritDoc}
122
     * @internal generated method: use only when explicitly handling proxy specific loading logic
123
     */
124
    public function __setInitialized($initialized)
125
    {
126
        $this->__isInitialized__ = $initialized;
127
    }
128
129
    /**
130
     * {@inheritDoc}
131
     * @internal generated method: use only when explicitly handling proxy specific loading logic
132
     */
133
    public function __setInitializer(\Closure $initializer = null)
134
    {
135
        $this->__initializer__ = $initializer;
136
    }
137
138
    /**
139
     * {@inheritDoc}
140
     * @internal generated method: use only when explicitly handling proxy specific loading logic
141
     */
142
    public function __getInitializer()
143
    {
144
        return $this->__initializer__;
145
    }
146
147
    /**
148
     * {@inheritDoc}
149
     * @internal generated method: use only when explicitly handling proxy specific loading logic
150
     */
151
    public function __setCloner(\Closure $cloner = null)
152
    {
153
        $this->__cloner__ = $cloner;
154
    }
155
156
    /**
157
     * {@inheritDoc}
158
     * @internal generated method: use only when explicitly handling proxy specific cloning logic
159
     */
160
    public function __getCloner()
161
    {
162
        return $this->__cloner__;
163
    }
164
165
    /**
166
     * {@inheritDoc}
167
     * @internal generated method: use only when explicitly handling proxy specific loading logic
168
     * @static
169
     */
170
    public function __getLazyProperties()
171
    {
172
        return self::$lazyPropertiesDefaults;
173
    }
174
175
    
176
    /**
177
     * {@inheritDoc}
178
     */
179
    public function isExists()
180
    {
181
182
        $this->__initializer__ && $this->__initializer__->__invoke($this, 'isExists', []);
183
184
        return parent::isExists();
185
    }
186
187
    /**
188
     * {@inheritDoc}
189
     */
190
    public function isPending()
191
    {
192
193
        $this->__initializer__ && $this->__initializer__->__invoke($this, 'isPending', []);
194
195
        return parent::isPending();
196
    }
197
198
    /**
199
     * {@inheritDoc}
200
     */
201
    public function isApproved()
202
    {
203
204
        $this->__initializer__ && $this->__initializer__->__invoke($this, 'isApproved', []);
205
206
        return parent::isApproved();
207
    }
208
209
    /**
210
     * {@inheritDoc}
211
     */
212
    public function getGenderTitle()
213
    {
214
215
        $this->__initializer__ && $this->__initializer__->__invoke($this, 'getGenderTitle', []);
216
217
        return parent::getGenderTitle();
218
    }
219
220
    /**
221
     * {@inheritDoc}
222
     */
223
    public function getAge($format = '%y')
224
    {
225
226
        $this->__initializer__ && $this->__initializer__->__invoke($this, 'getAge', [$format]);
227
228
        return parent::getAge($format);
229
    }
230
231
    /**
232
     * {@inheritDoc}
233
     */
234
    public function doActionOnPrePersist()
235
    {
236
237
        $this->__initializer__ && $this->__initializer__->__invoke($this, 'doActionOnPrePersist', []);
238
239
        return parent::doActionOnPrePersist();
0 ignored issues
show
Bug introduced by
Are you sure the usage of parent::doActionOnPrePersist() targeting EBloodBank\Models\Donor::doActionOnPrePersist() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
240
    }
241
242
    /**
243
     * {@inheritDoc}
244
     */
245
    public function get($key)
246
    {
247
248
        $this->__initializer__ && $this->__initializer__->__invoke($this, 'get', [$key]);
249
250
        return parent::get($key);
251
    }
252
253
    /**
254
     * {@inheritDoc}
255
     */
256
    public function display($key, $format = 'html')
257
    {
258
259
        $this->__initializer__ && $this->__initializer__->__invoke($this, 'display', [$key, $format]);
260
261
        return parent::display($key, $format);
0 ignored issues
show
Bug introduced by
Are you sure the usage of parent::display($key, $format) targeting EBloodBank\Models\Entity::display() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
262
    }
263
264
    /**
265
     * {@inheritDoc}
266
     */
267
    public function set($key, $value, $sanitize = false, $validate = true)
268
    {
269
270
        $this->__initializer__ && $this->__initializer__->__invoke($this, 'set', [$key, $value, $sanitize, $validate]);
271
272
        return parent::set($key, $value, $sanitize, $validate);
0 ignored issues
show
Bug introduced by
Are you sure the usage of parent::set($key, $value, $sanitize, $validate) targeting EBloodBank\Models\Entity::set() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
273
    }
274
275
    /**
276
     * {@inheritDoc}
277
     */
278
    public function getMeta(string $key, $fallback = '')
279
    {
280
281
        $this->__initializer__ && $this->__initializer__->__invoke($this, 'getMeta', [$key, $fallback]);
282
283
        return parent::getMeta($key, $fallback);
284
    }
285
286
    /**
287
     * {@inheritDoc}
288
     */
289
    public function setMeta(string $key, $value, $sanitize = false, $validate = true)
290
    {
291
292
        $this->__initializer__ && $this->__initializer__->__invoke($this, 'setMeta', [$key, $value, $sanitize, $validate]);
293
294
        return parent::setMeta($key, $value, $sanitize, $validate);
0 ignored issues
show
Bug introduced by
Are you sure the usage of parent::setMeta($key, $v..., $sanitize, $validate) targeting EBloodBank\Traits\EntityMeta::setMeta() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
295
    }
296
297
    /**
298
     * {@inheritDoc}
299
     */
300
    public function deleteMeta(string $key)
301
    {
302
303
        $this->__initializer__ && $this->__initializer__->__invoke($this, 'deleteMeta', [$key]);
304
305
        return parent::deleteMeta($key);
0 ignored issues
show
Bug introduced by
Are you sure the usage of parent::deleteMeta($key) targeting EBloodBank\Traits\EntityMeta::deleteMeta() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
306
    }
307
308
}
309