本文整理汇总了PHP中Carbon\Carbon::__get方法的典型用法代码示例。如果您正苦于以下问题:PHP Carbon::__get方法的具体用法?PHP Carbon::__get怎么用?PHP Carbon::__get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Carbon\Carbon
的用法示例。
在下文中一共展示了Carbon::__get方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __get
public function __get($name)
{
if ('weekday_name' === $name) {
return static::$days[parent::__get('dayOfWeek')];
} else {
return parent::__get($name);
}
}
示例2: __get
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));
}
}
示例3: __get
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;
}
}
示例4: __get
/**
* 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;
}
}
示例5: __get
/**
* 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);
}