InvalidExtractorException::getExtractorClass()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 1
Metric Value
c 2
b 1
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Oryzone PHPoAuthUserData package <https://github.com/Oryzone/PHPoAuthUserData>.
5
 *
6
 * (c) Oryzone, developed by Luciano Mammino <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace OAuth\UserData\Exception;
13
14
/**
15
 * Class InvalidExtractorException
16
 * @package OAuth\UserData\Exception
17
 */
18
class InvalidExtractorException extends \Exception implements Exception
19
{
20
    /**
21
     * @var string $serviceName
22
     */
23
    protected $extractorClass;
24
25
    /**
26
     * Constructor
27
     *
28
     * @param string      $extractorClass
29
     * @param string|null $message
30
     */
31
    public function __construct($extractorClass, $message = null)
32
    {
33
        $this->extractorClass = $extractorClass;
34
        if (null === $message) {
35
            $message = sprintf(
36
                'The class "%s" does not implement the interface OAuth\UserData\Extractor\ExtractorInterface',
37
                $extractorClass
38
            );
39
        }
40
        parent::__construct($message);
41
    }
42
43
    /**
44
     * Get the service name
45
     *
46
     * @return string
47
     */
48
    public function getExtractorClass()
49
    {
50
        return $this->extractorClass;
51
    }
52
}
53