Exemplo n.º 1
0
 /**
  * Get game clients.
  *
  * @param  \App\Models\Game $game
  * @return array
  */
 public function gameClients($game)
 {
     $clients = [];
     foreach ($game->users as $user) {
         $hash = array_search($user->api_token, $this->tokens);
         foreach ($this->clients as $client) {
             if ($this->clients->getHash($client) == $hash) {
                 $clients[] = $client;
                 continue;
             }
         }
     }
     return $clients;
 }
Exemplo n.º 2
0
 /**
  * @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0.
  */
 public function getHash($object)
 {
     // Cannot trigger a deprecation warning here because SplObjectStorage calls this method when attaching an object.
     return parent::getHash($object);
 }
Exemplo n.º 3
0
 /**
  * @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0.
  */
 public function getHash($object)
 {
     $this->triggerDeprecation(__METHOD__, true);
     return parent::getHash($object);
 }
Exemplo n.º 4
0
$obj->key();
// rewind()
// 返回并指向第一个节点元素
$obj->rewind();
// setInfo(mixed $data)
// 给当前节点赋值。必须是调用rewind后,才可以用setInfo赋值,否则找不到对象。
$obj->setInfo('AAA');
// getInfo()
// 获得当前节点的值。也必须是调用rewind后,才可以调用getInfo。
$obj->getInfo();
// current()
// 获得当前节点对象
$obj->current();
// getHash()
// 获得参数的hash值
$obj->getHash($a2);
// next()
// 指针移到下一个节点
$obj->next();
// offsetExists
// 判断对象容器中是否存在该对象
$obj->offsetExists($a2);
// offsetSet()
// 给对象容器中的某个对象设置值
$obj->offsetSet($a2, 'BBB');
// offsetGet()
// 获得对象容器中的某个针对象对应的值
$obj->offsetGet($a2);
// offsetUnset()
// 将某节点删除
//$obj->offsetUnset($a1);