/** * Determine if the graha is astangata (combustion). * * @return null|bool|array Combustion data */ public function isAstangata() { if (in_array($this->objectKey, [Graha::KEY_SY, Graha::KEY_RA, Graha::KEY_KE])) { return null; } $degreeSy = $this->getEnvironment()['graha'][Graha::KEY_SY]['longitude']; $degreeGr = $this->getEnvironment()['graha'][$this->objectKey]['longitude']; $distanceGraha = abs($degreeSy - $degreeGr); if (in_array($this->optionBhagaAstangata, [Biblio::BOOK_SS, Biblio::BOOK_BJ])) { $bhagas = Graha::listBhagaAstangata($this->optionBhagaAstangata); if (is_array($bhagas[$this->objectKey])) { $cheshta = $this->getLongitudeSpeed() >= 0 ? Graha::CHESHTA_SAMA : Graha::CHESHTA_VAKRA; $distanceCombustion = $bhagas[$this->objectKey][$cheshta]; } elseif (is_int($bhagas[$this->objectKey])) { $distanceCombustion = $bhagas[$this->objectKey]; } else { return null; } } else { $distanceCombustion = $this->optionBhagaAstangata; } if ($distanceGraha <= $distanceCombustion) { $percent = ($distanceCombustion - $distanceGraha) * 100 / $distanceCombustion; return ['distance' => $distanceGraha, 'combustion' => $distanceCombustion, 'percent' => $percent]; } else { return false; } }