Ejemplo n.º 1
0
 /**
  * @param $name
  * @param $dest
  *
  * @return bool
  */
 public static function quickCopy($name, $dest)
 {
     $upload = new static($name);
     if ($upload->isSubmit() && $upload->isSecure()) {
         return $upload->copy($dest);
     }
     return false;
 }
Ejemplo n.º 2
0
 /**
  * Returns true this instance will happen within the specified interval
  *
  * @param string|int $timeInterval the numeric value with space then time type.
  *    Example of valid types: 6 hours, 2 days, 1 minute.
  * @return bool
  */
 public function isWithinNext($timeInterval)
 {
     $now = new static();
     $interval = $now->copy()->modify('+' . $timeInterval);
     $thisTime = $this->format('U');
     return $thisTime <= $interval->format('U') && $thisTime >= $now->format('U');
 }
Ejemplo n.º 3
0
 /**
  * Converts this instance to ecliptic coordinates
  * @param  Angle $obli The Earth's obliquity
  * @return Eclip
  */
 public function toEclip(Angle $obli = null)
 {
     // Use original coordinates if already apparent
     $orig = $this->isApparent() ? $this->orig->copy() : $this->copy();
     $orig->topo = null;
     $α = $orig->ra->toAngle()->rad;
     $δ = $orig->dec->rad;
     $ε = $obli ? $obli->rad : $orig->obli()->rad;
     $λ = atan2(sin($α) * cos($ε) + tan($δ) * sin($ε), cos($α));
     $β = asin(sin($δ) * cos($ε) - cos($δ) * sin($ε) * sin($α));
     return new Eclip(Angle::rad($λ)->norm(), Angle::rad($β), $this->dist);
 }
Ejemplo n.º 4
0
 /**
  * Returns true this instance will happen within the specified interval
  *
  * @param string|int $timeInterval the numeric value with space then time type.
  *    Example of valid types: 6 hours, 2 days, 1 minute.
  * @return bool
  */
 public function isWithinNext($timeInterval)
 {
     $now = new static();
     $interval = $now->copy()->modify('+' . $timeInterval);
     return $this <= $interval && $this >= $now;
 }