Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2c3ab74
commit af906be
Showing
4 changed files
with
79 additions
and
38 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php declare(strict_types=1); | ||
/* | ||
* This file is part of phpunit/php-code-coverage. | ||
* | ||
* (c) Sebastian Bergmann <sebastian@phpunit.de> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
namespace SebastianBergmann\CodeCoverage\Report\Html; | ||
|
||
use SebastianBergmann\CodeCoverage\InvalidArgumentException; | ||
|
||
/** | ||
* @psalm-immutable | ||
*/ | ||
final class Thresholds | ||
{ | ||
private int $lowUpperBound; | ||
|
||
private int $highLowerBound; | ||
|
||
public static function default(): self | ||
{ | ||
return new self(50, 90); | ||
} | ||
|
||
/** | ||
* @throws InvalidArgumentException | ||
*/ | ||
public static function from(int $lowUpperBound, int $highLowerBound): self | ||
{ | ||
if ($lowUpperBound > $highLowerBound) { | ||
throw new InvalidArgumentException( | ||
'$lowUpperBound must not be larger than $highLowerBound' | ||
); | ||
} | ||
|
||
return new self($lowUpperBound, $highLowerBound); | ||
} | ||
|
||
private function __construct(int $lowUpperBound, int $highLowerBound) | ||
{ | ||
$this->lowUpperBound = $lowUpperBound; | ||
$this->highLowerBound = $highLowerBound; | ||
} | ||
|
||
public function lowUpperBound(): int | ||
{ | ||
return $this->lowUpperBound; | ||
} | ||
|
||
public function highLowerBound(): int | ||
{ | ||
return $this->highLowerBound; | ||
} | ||
} |