1<?php 2namespace GuzzleHttp\Ring\Future; 3 4/** 5 * Implements common future functionality that is triggered when the result 6 * property is accessed via a magic __get method. 7 * 8 * @property mixed $_value Actual data used by the future. Accessing this 9 * property will cause the future to block if needed. 10 */ 11trait MagicFutureTrait 12{ 13 use BaseFutureTrait; 14 15 /** 16 * This function handles retrieving the dereferenced result when requested. 17 * 18 * @param string $name Should always be "data" or an exception is thrown. 19 * 20 * @return mixed Returns the dereferenced data. 21 * @throws \RuntimeException 22 * @throws \GuzzleHttp\Ring\Exception\CancelledException 23 */ 24 public function __get($name) 25 { 26 if ($name !== '_value') { 27 throw new \RuntimeException("Class has no {$name} property"); 28 } 29 30 return $this->_value = $this->wait(); 31 } 32} 33