MissingOrInvalidInputData   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 28
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 12 1
A getRequiredDataKeys() 0 4 1
A getInputDataKeys() 0 4 1
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