Opis\Closure\ClosureStream::register PHP Метод

register() публичный статический Метод

public static register ( )
    public static function register()
    {
        if (!static::$isRegistred) {
            static::$isRegistred = stream_wrapper_register(static::STREAM_PROTO, __CLASS__);
        }
    }

Usage Example

Пример #1
0
 /**
  * Implementation of Serializable::unserialize()
  *
  * @param   string $data Serialized data
  */
 public function unserialize($data)
 {
     ClosureStream::register();
     if (!static::supportBinding()) {
         $this->unserializePHP53($data);
         return;
     }
     $this->code = unserialize($data);
     if ($this->code['use']) {
         $this->code['use'] = array_map(array($this, 'mapPointers'), $this->code['use']);
         extract($this->code['use'], EXTR_OVERWRITE | EXTR_REFS);
     }
     $this->closure = (include ClosureStream::STREAM_PROTO . '://' . $this->code['function']);
     if ($this->code['this'] === $this) {
         $this->code['this'] = null;
     }
     if ($this->code['scope'] !== null || $this->code['this'] !== null) {
         if ($this->code['this'] !== null) {
             $this->isBound = $this->serializeThis = true;
         }
         $this->closure = $this->closure->bindTo($this->code['this'], $this->code['scope']);
     }
     $this->code = $this->code['function'];
 }