Пример #1
0
 protected function makePlanetExtras(planetExtraInfo $extra)
 {
     $array = [];
     $atmosphere = [];
     $composition = [];
     $commonNames = \App\Myclasses\Arrays::commonExtraNames();
     $volcanism = \App\Myclasses\Arrays::volcanism();
     $atmType = \App\Myclasses\Arrays::atmosphereType();
     foreach ($extra->common as $key => $value) {
         if ($key == 'volcanism') {
             $value = $volcanism[$value];
         }
         if ($key == 'atm_type') {
             $value = $atmType[$value];
         }
         $newKey = $commonNames[$key];
         $array[$newKey] = $value;
     }
     $compName = \App\Myclasses\Arrays::planetComposition();
     foreach ($extra->composition as $key => $value) {
         $newKey = $compName[$key];
         $composition[$newKey] = $value . ' %';
     }
     $array['composition'] = $composition;
     $atmNames = \App\Myclasses\Arrays::atmosphereComposition();
     foreach ($extra->atmosphere as $key => $value) {
         if ($value == 0) {
             continue;
         }
         $newKey = $atmNames[$key];
         $atmosphere[$newKey] = $value . ' %';
     }
     $array['atmosphereC'] = $atmosphere;
     $orbitNames = \App\Myclasses\Arrays::orbitExtraNames();
     foreach ($extra->orbit as $key => $value) {
         $newKey = $orbitNames[$key];
         $array[$newKey] = $value;
     }
     return $array;
 }