Test Setup Failed
Pull Request — latest (#3)
by Mark
34:22
created

ExtensionRequiredLibraryException   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
eloc 9
c 1
b 0
f 1
dl 0
loc 15
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 13 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace UnicornFail\Emoji\Exception;
6
7
class ExtensionRequiredLibraryException extends \RuntimeException implements EmojiException
8
{
9
    public function __construct(string $library, ?object $object = null, ?\Throwable $previous = null)
10
    {
11
        $class = $object
12
            ? \get_class($object)
13
            : false;
14
15
        if ($class !== false) {
16
            $message = \sprintf("%s requires the following library to be installed:\n\ncomposer require %s\n\n", $class, $library);
17
        } else {
18
            $message = \sprintf("The following library is required to be installed:\n\ncomposer require %s\n\n", $library);
19
        }
20
21
        parent::__construct($message, 0, $previous);
22
    }
23
}
24