| Total Complexity | 6 |
| Total Lines | 57 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | final class Requirement |
||
| 21 | { |
||
| 22 | private $checkIsFulfilled; |
||
| 23 | private $fulfilled; |
||
| 24 | private $testMessage; |
||
| 25 | private $helpText; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @param string $checkIsFulfilled Callable as a string (it will be evaluated with `eval()` returning a `bool` value telling whether the |
||
| 29 | * requirement is fulfilled or not. The condition is evaluated lazily. |
||
| 30 | * @param string $testMessage The message for testing the requirement |
||
| 31 | * @param string $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) |
||
| 32 | */ |
||
| 33 | public function __construct( |
||
| 34 | $checkIsFulfilled, |
||
| 35 | $testMessage, |
||
| 36 | $helpText |
||
| 37 | ) { |
||
| 38 | $this->checkIsFulfilled = $checkIsFulfilled; |
||
| 39 | $this->testMessage = (string) $testMessage; |
||
| 40 | $this->helpText = $helpText; |
||
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * {@inheritdoc} |
||
| 45 | */ |
||
| 46 | public function isFulfilled() |
||
| 47 | { |
||
| 48 | if (null === $this->fulfilled) { |
||
| 49 | $this->fulfilled = eval($this->checkIsFulfilled); |
||
|
1 ignored issue
–
show
|
|||
| 50 | } |
||
| 51 | |||
| 52 | return $this->fulfilled; |
||
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
| 56 | * @return string |
||
| 57 | */ |
||
| 58 | public function getIsFullfilledChecker() |
||
| 61 | } |
||
| 62 | |||
| 63 | /** |
||
| 64 | * @return string |
||
| 65 | */ |
||
| 66 | public function getTestMessage() |
||
| 69 | } |
||
| 70 | |||
| 71 | /** |
||
| 72 | * @return string |
||
| 73 | */ |
||
| 74 | public function getHelpText() |
||
| 77 | } |
||
| 78 | } |