Authorizer::getAuthUrl()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 1
1
<?php
2
declare(strict_types=1);
3
4
/**
5
 * Authorization Provider Class
6
 * @category    Ticaje
7
 * @author      Max Demian <[email protected]>
8
 */
9
10
namespace Ticaje\AeSdk\Infrastructure\Provider\Authorization;
11
12
use Ticaje\AeSdk\Infrastructure\Interfaces\Provider\Auth\AuthBuilderInterface;
13
use Ticaje\AeSdk\Infrastructure\Interfaces\Provider\Auth\GrantAccessInterface;
14
15
/**
16
 * Class Authorizer
17
 * @package Ticaje\AeSdk\Infrastructure\Provider\Authorization
18
 */
19
class Authorizer implements GrantAccessInterface
20
{
21
    private $builder;
22
23
    private $baseUri;
24
25
    /**
26
     * Authorizer constructor.
27
     * @param AuthBuilderInterface $builder
28
     * @param string $baseUri
29
     */
30
    public function __construct(
31
        AuthBuilderInterface $builder,
32
        string $baseUri
33
    ) {
34
        $this->baseUri = $baseUri;
35
        $this->builder = $builder;
36
    }
37
38
    /**
39
     * @inheritDoc
40
     * This is a full business constraint
41
     */
42
    public function getAuthUrl(array $params): string
43
    {
44
        $queryString = $this->builder->build($params);
45
        $result = "{$this->baseUri}?{$queryString}";
46
        return $result;
47
    }
48
}
49