MissingOrInvalidInputData::getRequiredDataKeys()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/**
3
 * @author Boris Guéry <[email protected]>
4
 */
5
6
namespace Bgy\OAuth2\GrantType;
7
8
class MissingOrInvalidInputData extends \InvalidArgumentException
9
{
10
    private $inputDataKeys    = [];
11
    private $requiredDataKeys = [];
12
13
    public function __construct($grantTypeIdentifier, array $inputDataKeys, array $requiredDataKeys)
14
    {
15
        $this->inputDataKeys    = $inputDataKeys;
16
        $this->requiredDataKeys = $requiredDataKeys;
17
18
        parent::__construct(sprintf(
19
                                'The grant_type "%s" requires the following data : "%s" but got "%s"',
20
                                $grantTypeIdentifier,
21
                                rtrim(implode(', ', $requiredDataKeys), ", "),
22
                                rtrim(implode(', ', $inputDataKeys), ", ")
23
                            ));
24
    }
25
26
    public function getRequiredDataKeys()
27
    {
28
        return $this->requiredDataKeys;
29
    }
30
31
    public function getInputDataKeys()
32
    {
33
        return $this->inputDataKeys;
34
    }
35
}
36