MadelineProto/src/Volatile.php

24 lines
536 B
PHP
Raw Normal View History

<?php
2017-05-16 22:19:42 +02:00
2017-05-16 22:19:54 +02:00
if (!extension_loaded('pthreads')) {
class Volatile extends Threaded
{
public function __set($offset, $value)
{
if ($offset === null) {
2017-05-17 23:51:39 +02:00
$offset = count((array) $this);
2017-05-16 22:19:54 +02:00
}
2017-05-16 22:19:42 +02:00
2017-05-16 22:19:54 +02:00
if (is_array($value)) {
$safety =
new self();
$safety->merge(
$this->convertToVolatile($value));
$value = $safety;
}
2017-05-17 23:51:13 +02:00
return $this->{$offset} = $value;
2017-05-16 22:19:54 +02:00
}
}
}