Adjust error message, shorten parameter name
This commit is contained in:
@@ -19,22 +19,22 @@ final class Badge
|
||||
}
|
||||
|
||||
/**
|
||||
* @param BadgeableInterface $object The object to be converted into a badge
|
||||
* @param BadgeableInterface $obj The object to be converted into a badge
|
||||
* @param string $class Extra classes you want to add to the badge template
|
||||
* @param ?string $colour Specify the colour for an objectless badge
|
||||
*/
|
||||
public function mount(?BadgeableInterface $object = null, string $class = '', string $colour = null, bool $outline = false): void
|
||||
public function mount(?BadgeableInterface $obj = null, string $class = '', string $colour = null, bool $outline = false): void
|
||||
{
|
||||
if (!$object && !$colour) {
|
||||
throw new \RuntimeException(sprintf("You must specify either a colour for the badge or an instance of %s.", BadgeableInterface::class));
|
||||
if (!$obj && !$colour) {
|
||||
throw new \RuntimeException(sprintf("You must specify either a colour an instance of \"%s\".", BadgeableInterface::class));
|
||||
}
|
||||
|
||||
if ($object && $colour) {
|
||||
throw new \RuntimeException(sprintf("You have specified both the colour \"%s\" and an instance of \"%s\". Please use one or the other.", $colour, $object::class));
|
||||
if ($obj && $colour) {
|
||||
throw new \RuntimeException(sprintf("You have specified both the colour \"%s\" and an instance of \"%s\". Please use one or the other.", $colour, $obj::class));
|
||||
}
|
||||
|
||||
if ($object) {
|
||||
$palette = $object->getBadgeColour()->getPalette();
|
||||
if ($obj) {
|
||||
$palette = $obj->getBadgeColour()->getPalette();
|
||||
}
|
||||
|
||||
if ($colour) {
|
||||
|
||||
Reference in New Issue
Block a user