Example #1
0
 public function getOnlineCitizens(Country $country, $page = 1)
 {
     $xs = $this->getClient()->get('main/online-users/' . $country->getEncodedName() . '/all/' . $page)->send()->xpath();
     return $xs->findAll('//div[@class="citizen"]')->map(function (Node $node) {
         $url = $node->find('div[@class="nameholder"]/a[1]/@href')->extract();
         return ['id' => (int) substr($url, strrpos($url, '/') + 1), 'name' => trim($node->find('div[@class="nameholder"]/a[1]')->extract()), 'avatar' => $node->find('div[@class="avatarholder"]/a[1]/img[1]/@src')->extract()];
     });
 }
 /**
  * {@inheritDoc}
  */
 public function getCode()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getCode', array());
     return parent::getCode();
 }