|
@@ 257-270 (lines=14) @@
|
| 254 |
|
* @return $this |
| 255 |
|
* @throws \LogicException Thrown if the reason is unknown or does not have a version requirement associated. |
| 256 |
|
*/ |
| 257 |
|
public function addRequirement($reason, $line = -1, $msg = null, array $data = []) |
| 258 |
|
{ |
| 259 |
|
$version = Reason::getVersionFromReason($reason); |
| 260 |
|
|
| 261 |
|
if ($version === false) { |
| 262 |
|
throw new \LogicException(sprintf('%s::%s requires a reason a version can be associated to. Use %s::addArbitraryRequirement() to add any version with any reasoning to the result.', |
| 263 |
|
__CLASS__, __METHOD__, __CLASS__)); |
| 264 |
|
} |
| 265 |
|
|
| 266 |
|
$this->addArbitraryVersionConstraint(self::VERSION_LIMIT_MAX, $version, $line, $msg, $reason, |
| 267 |
|
$data); |
| 268 |
|
|
| 269 |
|
return $this; |
| 270 |
|
} |
| 271 |
|
|
| 272 |
|
/** |
| 273 |
|
* @param int $reason |
|
@@ 279-292 (lines=14) @@
|
| 276 |
|
* @param array $data |
| 277 |
|
* @return $this |
| 278 |
|
*/ |
| 279 |
|
public function addLimit($reason, $line = -1, $msg = null, array $data = []) |
| 280 |
|
{ |
| 281 |
|
$version = Reason::getVersionFromReason($reason); |
| 282 |
|
|
| 283 |
|
if ($version === false) { |
| 284 |
|
throw new \LogicException(sprintf('%s::%s requires a reason a version can be associated to. Use %s::addArbitraryLimit() to add any version with any reasoning to the result.', |
| 285 |
|
__CLASS__, __METHOD__, __CLASS__)); |
| 286 |
|
} |
| 287 |
|
|
| 288 |
|
$this->addArbitraryVersionConstraint(self::VERSION_LIMIT_MIN, $version, $line, $msg, $reason, |
| 289 |
|
$data); |
| 290 |
|
|
| 291 |
|
return $this; |
| 292 |
|
} |
| 293 |
|
|
| 294 |
|
/** |
| 295 |
|
* @param string $version |