public function CarbonInterval::__get in Persian Date for Drupal 8 8.4
Get a part of the CarbonInterval object
Parameters
string $name:
Return value
int
Throws
\InvalidArgumentException
File
- src/
Library/ Carbon/ CarbonInterval.php, line 320
Class
- CarbonInterval
- A simple API extension for DateInterval. The implementation provides helpers to handle weeks but only days are saved. Weeks are calculated based on the total days of the current instance.
Namespace
Drupal\persian_date\Library\CarbonCode
public function __get($name) {
switch ($name) {
case 'years':
return $this->y;
case 'months':
return $this->m;
case 'dayz':
return $this->d;
case 'hours':
return $this->h;
case 'minutes':
return $this->i;
case 'seconds':
return $this->s;
case 'weeks':
return (int) floor($this->d / Carbon::DAYS_PER_WEEK);
case 'daysExcludeWeeks':
case 'dayzExcludeWeeks':
return $this->d % Carbon::DAYS_PER_WEEK;
default:
throw new InvalidArgumentException(sprintf("Unknown getter '%s'", $name));
}
}