public function CarbonInterval::__call in Persian Date for Drupal 8 8.4
Allow fluent calls on the setters... CarbonInterval::years(3)->months(5)->day().
Note: This is done using the magic method to allow static and instance methods to have the same names.
Parameters
string $name:
array $args:
Return value
static
File
- src/
Library/ Carbon/ CarbonInterval.php, line 420
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 __call($name, $args) {
$arg = count($args) === 0 ? 1 : $args[0];
switch ($name) {
case 'years':
case 'year':
$this->years = $arg;
break;
case 'months':
case 'month':
$this->months = $arg;
break;
case 'weeks':
case 'week':
$this->dayz = $arg * Carbon::DAYS_PER_WEEK;
break;
case 'days':
case 'dayz':
case 'day':
$this->dayz = $arg;
break;
case 'hours':
case 'hour':
$this->hours = $arg;
break;
case 'minutes':
case 'minute':
$this->minutes = $arg;
break;
case 'seconds':
case 'second':
$this->seconds = $arg;
break;
}
return $this;
}