Exemplo n.º 1
0
 public function getCenterPlanets(centerInside $center)
 {
     $planets = $center->givePlanetsData();
     $result = [];
     if ($planets) {
         foreach ($planets as $planet) {
             if (!$this->isDiscByUser($planet)) {
                 continue;
             }
             $name = $this->makePlanetName($planet);
             $image = $this->makePlanetImage($planet);
             $type = $planet->type;
             if (isset($planet->extra)) {
                 $extraD = $this->makePlanetExtras($planet->extra);
                 $name = $name . ' / ' . $this->addGravity($planet->extra);
                 $result[$planet->id] = ['name' => $name, 'image' => $image, 'type' => $type, 'extra' => $extraD];
             } else {
                 $result[$planet->id] = ['name' => $name, 'image' => $image, 'type' => $type];
             }
         }
     }
     return $result;
 }
Exemplo n.º 2
0
 public function getCenterId(centerInside $center)
 {
     $array = $center->giveSelfData();
     if (isset($array['self'])) {
         return $array['self'];
     } else {
         $star = reset($array);
         return $star->id;
     }
 }