public function getPoliticians()
 {
     $politicians = $this->politicianAggregate->getPoliticians();
     foreach ($politicians as $politician) {
         if (!empty($politician->nomeReal)) {
             $dom = $this->search($politician->nomeReal);
             if ($dom instanceof \DOMDocument) {
                 $politicianInfoBuilder = new PoliticianInfoBuilder($dom);
                 $politicianInfoBuilder->build($politician);
             }
         }
     }
     return $politicians;
 }
示例#2
0
 public function getPoliticians()
 {
     if ($this->politicians === null) {
         $aggregate = new PoliticianAggregate();
         $aggregate->setPath($this->path);
         $decorator = new PoliticianAggregateDecorator($aggregate);
         $politicians = $decorator->getPoliticians();
         uasort($politicians, function ($a, $b) {
             if ($a->quantidadeVotos == $b->quantidadeVotos) {
                 return 0;
             } else {
                 if ($a->quantidadeVotos > $b->quantidadeVotos) {
                     return -1;
                 } else {
                     return 1;
                 }
             }
         });
         $this->politicians = $politicians;
     }
     return $this->politicians;
 }