diff options
Diffstat (limited to '')
-rw-r--r-- | vendor/simshaun/recurr/src/Recurr/Transformer/Constraint/AfterConstraint.php | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/vendor/simshaun/recurr/src/Recurr/Transformer/Constraint/AfterConstraint.php b/vendor/simshaun/recurr/src/Recurr/Transformer/Constraint/AfterConstraint.php new file mode 100644 index 0000000..3baf9a0 --- /dev/null +++ b/vendor/simshaun/recurr/src/Recurr/Transformer/Constraint/AfterConstraint.php @@ -0,0 +1,64 @@ +<?php + +/* + * Copyright 2014 Shaun Simmons + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Recurr\Transformer\Constraint; + +use Recurr\Transformer\Constraint; + +class AfterConstraint extends Constraint +{ + + protected $stopsTransformer = false; + + /** @var \DateTimeInterface */ + protected $after; + + /** @var bool */ + protected $inc; + + /** + * @param \DateTimeInterface $after + * @param bool $inc Include date if it equals $after. + */ + public function __construct(\DateTimeInterface $after, $inc = false) + { + $this->after = $after; + $this->inc = $inc; + } + + /** + * Passes if $date is after $after + * + * {@inheritdoc} + */ + public function test(\DateTimeInterface $date) + { + if ($this->inc) { + return $date >= $this->after; + } + + return $date > $this->after; + } + + /** + * @return \DateTimeInterface + */ + public function getAfter() + { + return $this->after; + } + + /** + * @return bool + */ + public function isInc() + { + return $this->inc; + } +} |