Example #1
0
 public function __get($name)
 {
     if ('weekday_name' === $name) {
         return static::$days[parent::__get('dayOfWeek')];
     } else {
         return parent::__get($name);
     }
 }
Example #2
0
 public function __get($name)
 {
     try {
         return parent::__get($name);
     } catch (\Exception $e) {
         return $name == 'is' . $this->calendar_type;
         throw new \InvalidArgumentException(sprintf("Unknown getter '%s'", $name));
     }
 }
Example #3
0
 public function __get($word)
 {
     switch ($word) {
         case "solarDay":
             return $this->daySolar;
             break;
         case "solarDayName":
             return $this->farsiDayName();
             break;
         case "solarMonth":
             return $this->monthSolar;
             break;
         case "solarYear":
             return $this->yearSolar;
             break;
         case "monthName":
             return $this->format("F");
             break;
         case "solarMonthName":
             return $this->farsiMonthName();
             break;
         default:
             return parent::__get($word);
             break;
     }
 }
Example #4
0
 /**
  * Get a part of the Carbon object
  *
  * @param string $name
  *
  * @throws InvalidArgumentException
  *
  * @return string|integer|DateTimeZone
  */
 public function __get($name)
 {
     $formatter = $this->getFormatter(array('timezone' => 'GMT' . (parent::format('Z') ? parent::format('P') : '')));
     switch (true) {
         case $name === 'timestamp':
             return (int) $this->latinizeDigits($this->getTimestamp());
         case $name === 'weekOfMonth':
             $formatter->setPattern('W');
             return (int) $this->latinizeDigits($this->format('C'));
         case $name === 'quarter':
             $formatter->setPattern('q');
             return (int) $this->latinizeDigits($formatter->classicFormat($this->getTimestamp()));
         default:
             $this->__latinaze = true;
             $result = parent::__get($name);
             $this->__latinaze = false;
             return $result;
     }
 }
Example #5
0
 /**
  * Get a part of the Sunny object
  *
  * @param  string $name
  *
  * @throws InvalidArgumentException
  *
  * @return float|string
  */
 public function __get($name)
 {
     switch ($name) {
         case 'latitude':
             return (double) $this->latitude;
         case 'longitude':
             return (double) $this->longitude;
         case 'zenith':
             return (double) $this->zenith;
         case 'sunrise':
             return $this->getSunrise();
         case 'sunset':
             return $this->getSunset();
         case 'sunnyMinutes':
             return $this->getSunnyMinutes();
         case 'sunnyTime':
             return $this->getSunnyTime();
     }
     return parent::__get($name);
 }