Completed
Push — development ( 67765c...7029e6 )
by Andrij
18:12
created

PropelBaseModelClass::postSave()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace CMSFactory;
4
5
use CMSFactory\DependencyInjection\DependencyInjectionProvider;
6
use Currency\Currency;
7
use CustomFieldsData;
8
use CustomFieldsDataQuery;
9
use CustomFieldsQuery;
10
use Doctrine\Common\Cache\CacheProvider;
11
use MY_Controller;
12
use MY_Form_validation;
13
use Propel\Runtime\Connection\ConnectionInterface;
14
15
class PropelBaseModelClass implements \Serializable
16
{
0 ignored issues
show
introduced by
Opening brace of a class must be on the same line as the definition
Loading history...
17
18
    public $customFields;
19
20
    public $customData;
21
22
    public $hasCustomData = false;
23
24
    public $entityId;
25
26
    private $entities_locale = [
27
                                'product',
28
                                'category',
29
                                'brand',
30
                               ];
31
32
    /**
33
     * @param MY_Form_validation $validator
34
     * @return mixed
0 ignored issues
show
Documentation introduced by
Consider making the return type a bit more specific; maybe use MY_Form_validation.

This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.

Loading history...
35
     */
36
    public function validateCustomData($validator) {
37
        if (!empty($this->entityName)) {
0 ignored issues
show
Documentation introduced by
The property entityName does not exist on object<CMSFactory\PropelBaseModelClass>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
38
            $this->collectCustomData($this->entityName, $this->getId());
0 ignored issues
show
Documentation introduced by
The property entityName does not exist on object<CMSFactory\PropelBaseModelClass>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
Documentation Bug introduced by
The method getId does not exist on object<CMSFactory\PropelBaseModelClass>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
39
40
            if ($this->hasCustomData !== false) {
41
                foreach ($_POST['custom_field'] as $key_post => $value_post) {
42
                    foreach ($this->customFields as $key => $value) {
43
                        if ((int) $key_post == $value['Id']) {
44
45
                            $validator_str = '';
46
                            if ($value['IsRequired'] && $this->curentPostEntitySave($key)) {
47
                                $validator_str = 'required';
48
                            }
49
                            if ($value['Validators'] && $this->curentPostEntitySave($key)) {
50
                                $validator_str .= '|' . $value['Validators'];
51
                            }
52
                            $name = array_shift($value['CustomFieldsI18ns'])['FieldLabel'];
53
                            $validator->set_rules("custom_field[$key]", $name, $validator_str);
54
                        }
55
                    }
56
                }
57
            }
58
        }
59
        return $validator;
60
    }
61
62
    /**
63
     * @param string $entityName
64
     * @param int $id
65
     * @return bool
0 ignored issues
show
Documentation introduced by
Should the return type not be null|false?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
66
     */
67
    public function collectCustomData($entityName, $id) {
68
        $this->entityId = $id;
69
        $this->customFields = CustomFieldsQuery::create()
70
            ->joinWithI18n(MY_Controller::defaultLocale())
71
            ->filterByIsActive(1)
72
            ->filterByEntity($entityName)
73
            ->find()
74
            ->toArray($keyColumn = 'id');
75
76
        if (count($this->customFields)) {
77
            $this->hasCustomData = true;
78
        } else {
79
            return false;
80
        }
81
    }
82
83
    /**
84
     * @param int $key
85
     * @return bool
0 ignored issues
show
Documentation introduced by
Should the return type not be boolean|null?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
86
     */
87
    public function curentPostEntitySave($key) {
88
        $entity = CustomFieldsQuery::create()->findPk($key);
89
        if ($entity) {
90
            return $entity->getEntity() == $this->entityName;
0 ignored issues
show
Documentation introduced by
The property entityName does not exist on object<CMSFactory\PropelBaseModelClass>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
91
        }
92
    }
93
94
    public function saveCustomData() {
95
96
        $locale = in_array($this->entityName, $this->entities_locale, true) ? chose_language() : MY_Controller::defaultLocale();
0 ignored issues
show
Documentation introduced by
The property entityName does not exist on object<CMSFactory\PropelBaseModelClass>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
97
98
        if ($this->hasCustomData === false) {
99
            $this->collectCustomData($this->entityName, $this->getId());
0 ignored issues
show
Documentation introduced by
The property entityName does not exist on object<CMSFactory\PropelBaseModelClass>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
Documentation Bug introduced by
The method getId does not exist on object<CMSFactory\PropelBaseModelClass>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
100
        }
101
        $data = $_POST['custom_field'];
102
103
        foreach ($this->customFields as $fieldObject) {
104
            if (!array_key_exists($fieldObject['Id'], $_POST['custom_field'])) {
105
                $data[$fieldObject['Id']] = '';
106
            }
107
            foreach ($data as $key => $value) {
108
                if ((int) $key == $fieldObject['Id']) {
109
110
                    $objCustomData = CustomFieldsDataQuery::create()
111
                        ->filterByentityId($this->entityId)
112
                        ->filterByfieldId($key)
113
                        ->filterByLocale($locale)
114
                        ->findOne();
115
                    if ($objCustomData) {
116
                        $objCustomData->setdata($value);
117
                        $objCustomData->save();
118
                        break;
119
                    } else {
120
                        $fieldObject = new CustomFieldsData();
121
                        $fieldObject->setentityId($this->entityId);
122
                        $fieldObject->setfieldId($key);
123
                        $fieldObject->setdata($value);
124
                        $fieldObject->setLocale($locale);
125
                        $fieldObject->save();
126
                        break;
127
                    }
128
                }
129
            }
130
        }
131
    }
132
133
    /**
134
     * @param $attributeName
0 ignored issues
show
introduced by
Missing parameter type
Loading history...
135
     * @return mixed
136
     */
137
    public function getLabel($attributeName) {
138
        if (method_exists($this, 'attributeLabels')) {
139
            $labels = $this->attributeLabels();
0 ignored issues
show
Documentation Bug introduced by
The method attributeLabels does not exist on object<CMSFactory\PropelBaseModelClass>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
140
141
            if (isset($labels[$attributeName])) {
142
                return $labels[$attributeName];
143
            } else {
144
                return $attributeName;
145
            }
146
        }
147
    }
148
149
    /**
150
     * @param string $column
151
     * @return bool
152
     */
153
    public function getVirtual($column) {
154
        $column = strtolower($column);
155
        return $this->getVirtualColumn($column);
156
    }
157
158
    /**
159
     * @param string $name
160
     * @return bool
161
     */
162
    public function getVirtualColumn($name) {
163
        $name = strtolower($name);
164
165
        if (!$this->hasVirtualColumn($name)) {
0 ignored issues
show
Documentation Bug introduced by
The method hasVirtualColumn does not exist on object<CMSFactory\PropelBaseModelClass>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
166
            return false;
167
        }
168
        return parent::getVirtualColumn($name);
169
    }
170
171
    /**
172
     * Convert model attribute(by default Price). e.g. "99.99 $"
173
     *
174
     * @param string $attributeName Optional. Attribute name to convert.
175
     * @access public
176
     * @return string
177
     */
178
    public function toCurrency($attributeName = 'Price', $cId = null, $convertForTemplate = false) {
179
        $attributeName = strtolower($attributeName);
180
        $get = 'get' . $attributeName;
181
182
        if (!$convertForTemplate) {
183
            if ($attributeName == 'origprice') {
184
                return Currency::create()->convert($this->getVirtualColumn('origprice'), $cId);
185
            }
186
            return Currency::create()->convert($this->$get(), $cId);
187
        } else {
188
            if ($attributeName == 'origprice') {
189
                return Currency::create()->convertForTemplate($this->getVirtualColumn('origprice'), $cId);
190
            }
191
            return Currency::create()->convertForTemplate($this->$get(), $cId);
192
        }
193
    }
194
195
    /**
196
     * Simple getter.
197
     *
198
     * @param  $name
0 ignored issues
show
introduced by
Missing parameter type
Loading history...
199
     * @return
0 ignored issues
show
introduced by
Return type missing for @return tag in function comment
Loading history...
200
     */
201
    public function __get($name) {
202
        if (isset($this->$name)) {
203
            return $this->$name;
204
        }
205
206
        $call = 'get' . $name;
207
        if (method_exists($this, $call)) {
208
            return $this->$call();
209
        }
210
    }
211
212
    /**
213
     * @return CacheProvider
0 ignored issues
show
Documentation introduced by
Should the return type not be CacheProvider|null?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
214
     */
215
    public function getCache() {
216
217
        return DependencyInjectionProvider::getContainer()->get('cache');
218
    }
219
220
    public function __call($name, $param) {
221
222
        if (preg_match('/get(\w+)/', $name, $matches)) {
223
            $virtualColumn = $matches[1];
224
            $virtualColumn = strtolower($virtualColumn);
225
            if ($this->hasVirtualColumn($virtualColumn)) {
0 ignored issues
show
Documentation Bug introduced by
The method hasVirtualColumn does not exist on object<CMSFactory\PropelBaseModelClass>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
226
                return $this->getVirtualColumn($virtualColumn);
227
            }
228
            // no lcfirst in php<5.3...
229
            $virtualColumn[0] = strtolower($virtualColumn[0]);
230
            if ($this->hasVirtualColumn($virtualColumn)) {
0 ignored issues
show
Documentation Bug introduced by
The method hasVirtualColumn does not exist on object<CMSFactory\PropelBaseModelClass>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
231
                return $this->getVirtualColumn($virtualColumn);
232
            }
233
        }
234
    }
235
236
    public function setVirtualColumn($name, $value) {
237
238
        $name = strtolower($name);
239
240
        parent::setVirtualColumn($name, $value);
241
    }
242
243
    public function preSave(ConnectionInterface $con = null) {
244
        return true;
245
    }
246
247
    public function postSave(ConnectionInterface $con = null) {
248
        return true;
249
    }
250
251
    public function preInsert(ConnectionInterface $con = null) {
252
        return true;
253
    }
254
255
    public function postInsert(ConnectionInterface $con = null) {
256
        return true;
257
    }
258
259
    public function preUpdate(ConnectionInterface $con = null) {
260
        return true;
261
    }
262
263
    public function postUpdate(ConnectionInterface $con = null) {
264
        return true;
265
    }
266
267
    public function postDelete(ConnectionInterface $con = null) {
268
        return true;
269
    }
270
271
    public function preDelete(ConnectionInterface $con = null) {
272
        return true;
273
    }
274
275
    /**
276
     * String representation of object
277
     * @link http://php.net/manual/en/serializable.serialize.php
278
     * @return string the string representation of the object or null
279
     * @since 5.1.0
280
     */
281
    public function serialize() {
282
        $this->prepareToSleep();
283
284
        $cls = new \ReflectionClass($this);
285
        $propertyNames = [];
286
        $serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC));
287
288
        foreach ($serializableProperties as $property) {
289
290
            $propertyName = $property->getName();
291
            $propertyValue = $this->$propertyName;
292
293
            if ($propertyValue !== null) {
294
                $propertyNames[$propertyName] = $propertyValue;
295
296
            }
297
298
        }
299
300
        return serialize($propertyNames);
301
    }
302
303
    private function prepareToSleep() {
304
        $this->collSCategoriesRelatedById = null;
0 ignored issues
show
Bug introduced by
The property collSCategoriesRelatedById does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
305
        $this->collSCategoryI18ns = null;
0 ignored issues
show
Bug introduced by
The property collSCategoryI18ns does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
306
        $this->collSProductss = null;
0 ignored issues
show
Bug introduced by
The property collSProductss does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
307
        $this->collShopProductCategoriess = null;
0 ignored issues
show
Bug introduced by
The property collShopProductCategoriess does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
308
        $this->collShopProductPropertiesCategoriess = null;
0 ignored issues
show
Bug introduced by
The property collShopProductPropertiesCategoriess does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
309
        $this->collProducts = null;
0 ignored issues
show
Bug introduced by
The property collProducts does not seem to exist. Did you mean collSProductss?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
310
        $this->collProperties = null;
0 ignored issues
show
Bug introduced by
The property collProperties does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
311
        $this->aSCategory = null;
0 ignored issues
show
Bug introduced by
The property aSCategory does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
312
    }
313
314
    /**
315
     * Constructs the object
316
     * @link http://php.net/manual/en/serializable.unserialize.php
317
     * @param string $serialized <p>
0 ignored issues
show
introduced by
Paramater tags must be grouped together in a doc commment
Loading history...
318
     * The string representation of the object.
319
     * </p>
0 ignored issues
show
introduced by
Parameter comment must end with a full stop
Loading history...
320
     * @return void
0 ignored issues
show
introduced by
If there is no return value for a function, there must not be a @return tag.
Loading history...
321
     * @since 5.1.0
322
     */
323
    public function unserialize($serialized) {
324
        $serialized = unserialize($serialized);
325
326
        foreach ($serialized as $key => $item) {
327
328
            $this->$key = $item;
329
330
        }
331
332
    }
333
334
}