Last active
October 16, 2015 15:05
-
-
Save vasildakov-zz/5c7d9556d711ba1a030a to your computer and use it in GitHub Desktop.
IsUserProvisionalStatusExpired
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* IsUserProvisionalStatusExpired | |
* | |
* @author Vasil Dakov <vasil.dakov@philippka.com> | |
* @copyright Copyright (c) 2014-2015 U.S. Soccer Federation (http://www.ussoccer.com) | |
*/ | |
namespace Application\Entity\Specification\UserProvisionalStatus; | |
use Application\Entity\Specification\Specification; | |
use Application\Entity\EntityInterface; | |
use Application\Entity\User; | |
use Application\Entity\Course; | |
use Application\Entity\UserProvisionalStatus; | |
class IsUserProvisionalStatusExpired implements Specification | |
{ | |
protected $course; | |
public function __construct(Course $course) | |
{ | |
$this->$course = $course; | |
} | |
public function isSatisfiedBy(EntityInterface $userProvisionalStatus) | |
{ | |
$course = $this->course; | |
$grantDate = $userProvisionalStatus->getGrantDate(); // DateTime | |
$validFrom = $userProvisionalStatus->getValidFrom(); // DateTime | |
$ValidityPeriod = $userProvisionalStatus->getProvisionalStatus()->getValidityPeriod(); // integer | |
$validity = $dateGrant->modify("+ $validityPeriod month"); | |
if($validFrom < $course->getStartDate() && $validity > $course->getStartDate() ) { | |
return true; | |
} | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment