aterThanOrEqualTo('2018-07-25 12:45:17'); // false * ``` * * @param \Carbon\Carbon|\DateTimeInterface|mixed $date * * @return bool */ø/** * Determines if the instance is less (before) than another * * @example * ``` * Carbon::parse('2018-07-25 12:45:16')->isBefore('2018-07-25 12:45:15'); // false * Carbon::parse('2018-07-25 12:45:16')->isBefore('2018-07-25 12:45:16'); // false * Carbon::parse('2018-07-25 12:45:16')->isBefore('2018-07-25 12:45:17'); // true * ``` * * @param \Carbon\Carbon|\DateTimeInterface|mixed $date * * @see lessThan() * * @return bool */ø/** * Determines if the instance is less (before) or equal to another * * @example * ``` * Carbon::parse('2018-07-25 12:45:16')->lte('2018-07-25 12:45:15'); // false * Carbon::parse('2018-07-25 12:45:16')->lte('2018-07-25 12:45:16'); // true * Carbon::parse('2018-07-25 12:45:16')->lte('2018-07-25 12:45:17'); // true * ``` * * @param \Carbon\Carbon|\DateTimeInterface|mixed $date * * @see lessThanOrEqualTo() * * @return bool */û/** * Determines if the instance is less (before) or equal to another * * @example * ``` * Carbon::parse('2018-07-25 12:45:16')->lessThanOrEqualTo('2018-07-25 12:45:15'); // false * Carbon::parse('2018-07-25 12:45:16')->lessThanOrEqualTo('2018-07-25 12:45:16'); // true * Carbon::parse('2018-07-25 12:45:16')->lessThanOrEqualTo('2018-07-25 12:45:17'); // true * ``` * * @param \Carbon\Carbon|\DateTimeInterface|mixed $date * * @return bool */*/** * Determines if the instance is between two others, bounds included. * * @example * ``` * Carbon::parse('2018-07-25')->betweenIncluded('2018-07-14', '2018-08-01'); // true * Carbon::parse('2018-07-25')->betweenIncluded('2018-08-01', '2018-08-20'); // false * Carbon::parse('2018-07-25')->betweenIncluded('2018-07-25', '2018-08-01'); // true * ``` * * @param \Carbon\Carbon|\DateTimeInterface|mixed $date1 * @param \Carbon\Carbon|\DateTimeInterface|mixed $date2 * * @return bool */+/** * Determines if the instance is between two others, bounds excluded. * * @example * ``` * Carbon::parse('2018-07-25')->betweenExcluded('2018-07-14', '2018-08-01'); // true * Carbon::parse('2018-07-25')->betweenExcluded('2018-08-01', '2018-08-20'); // false * Carbon::parse('2018-07-25')->betweenExcluded('2018-07-25', '2018-08-01'); // false * ``` * * @param \Carbon\Carbon|\DateTimeInterface|mixed $date1 * @param \Carbon\Carbon|\DateTimeInterface|mixed $date2 * * @return bool *//** * Determines if the instance is a long year (using ISO 8601 year). * * @example * ``` * Carbon::parse('2015-01-01')->isLongIsoYear(); // true * Carbon::parse('2016-01-01')->isLongIsoYear(); // true * Carbon::parse('2016-01-03')->isLongIsoYear(); // false * Carbon::parse('2019-12-29')->isLongIsoYear(); // false * Carbon::parse('2019-12-30')->isLongIsoYear(); // true * ``` * * @see https://en.wikipedia.org/wiki/ISO_8601#Week_dates * * @return bool */hould not be prerelease.'); } } elseif (!$this->hasPreRelease()) { $next->setPatch($this->getPatch() + 1); } // The case of $this having a pre-release when $base does not means // that we are essentially just leaving pre-release. Nothing needs to // be done. return $next; } /** * Create a new Version that discards the entity information of build and * originalVersionString * * @return Version */ public function cleanCopy(): self { $version = new self(); $version->setPrefix($this->getPrefix()); $version->setMajor($this->getMajor()); $version->setMinor($this->getMinor()); $version->setPatch($this->getPatch()); if ($this->hasPreRelease()) { $version->preRelease = clone($this->getPreRelease()); } return $version; } /** * String representation of this Version * * @return string */ public function __toString() { $string = parent::__toString(); // Add pre-release if ($this->hasPreRelease()) { $string .= '-' . $this->getPreRelease(); } // Add build if ($this->hasBuild()) { $string .= '+' . $this->getBuild(); } return $string; } /** * Parse a new version or return an existing version * * @param int|string|Version $version * @return Version */ public static function parse(int|string|Version $version): self { if ($version instanceof self) { return $version; } return Parser::parse($version); } /** * Check if the version is greater than another version * * @param int|string|Version $v2 * @return bool */ public function greaterThan(int|string|Version $v2): bool { return Compare::greaterThan($this, self::parse($v2)); } /** * Check if the version is smaller than another version * * @param int|string|Version $v2 * @return bool */ public function smallerThan(int|string|Version $v2): bool { return Compare::smallerThan($this, self::parse($v2)); } /** * Check if the version is equals to another version * * @param int|string|Version $v2 * @return bool */ public function equals(int|string|Version $v2): bool { return Compare::equals($this, self::parse($v2)); } }