GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

JSONSchemaAppliance::setAuthScopes()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 0
cts 6
cp 0
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 4
nc 3
nop 1
crap 12
1
<?php
2
namespace Solvire\API\JSONSchema;
3
4
use Solvire\Utilities\OptionsChecker as Ch;
5
use Solvire\Application\Environment as Ev;
6
7
/**
8
 *
9
 * @author solvire <[email protected]>
10
 * @package JSONSchema
11
 * @namespace Solvire\API\JSONSchema
12
 */
13
class JSONSchemaAppliance implements Schemable
14
{
15
16
    protected $base = null;
17
18
    /**
19
     *
20
     * @var ResourceCollection
21
     */
22
    protected $resources = null;
23
24 3
    public function __construct($baseOptions = null)
25
    {
26 3
        $this->constructBase($baseOptions);
27 3
        $this->resources = new ResourceCollection();
28 3
    }
29
30
    /**
31
     *
32
     * @param \Solvire\API\JSONSchema\Resource $resource            
33
     * @return \Solvire\API\JSONSchema\JSONSchemaAppliance
34
     */
35
    public function registerResource(Resource $resource)
36
    {
37
        if ($this->resources == null)
38
            $this->resources = new ResourceCollection();
39
        
40
        $this->resources->add($resource);
0 ignored issues
show
Documentation introduced by
$resource is of type object<Solvire\API\JSONSchema\Resource>, but the function expects a resource.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
41
        return $this;
42
    }
43
44
    /**
45
     *
46
     * @param array $options            
47
     */
48 3
    public function constructBase(array $options = null)
49
    {
50 3
        if (! isset($this->base))
51 3
            $this->base = new Base();
52
        
53 3
        $this->base->setBaseUrl(isset($options['baseUrl']) ? $options['baseUrl'] : Ev::get('API_BASE_URL'));
0 ignored issues
show
Documentation introduced by
'API_BASE_URL' is of type string, but the function expects a object<Solvire\Application\unknown>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
54 3
        $this->base->setBasePath(isset($options['basePath']) ? $options['basePath'] : Ev::get('API_BASE_PATH'));
0 ignored issues
show
Documentation introduced by
'API_BASE_PATH' is of type string, but the function expects a object<Solvire\Application\unknown>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
55 3
        $this->base->setDocumentationUrl(isset($options['documentationUrl']) ? $options['documentationUrl'] : Ev::get('API_DOCUMENTATION_URL'));
0 ignored issues
show
Documentation introduced by
'API_DOCUMENTATION_URL' is of type string, but the function expects a object<Solvire\Application\unknown>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
56 3
        $this->base->setName(isset($options['applicationName']) ? $options['applicationName'] : Ev::get('APPLICATION_NAME'));
0 ignored issues
show
Documentation introduced by
'APPLICATION_NAME' is of type string, but the function expects a object<Solvire\Application\unknown>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
57 3
        $this->base->setId(isset($options['id']) ? $options['id'] : Ev::get('APPLICATION_NAME') . ":" . Ev::get('API_VERSION'));
0 ignored issues
show
Documentation introduced by
'APPLICATION_NAME' is of type string, but the function expects a object<Solvire\Application\unknown>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
Documentation introduced by
'API_VERSION' is of type string, but the function expects a object<Solvire\Application\unknown>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
58 3
        $this->base->setVersion(isset($options['version']) ? $options['version'] : Ev::get('API_VERSION'));
0 ignored issues
show
Documentation introduced by
'API_VERSION' is of type string, but the function expects a object<Solvire\Application\unknown>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
59 3
        $this->base->setDescription(isset($options['description']) ? $options['description'] : Ev::get('API_DESCRIPTION'));
0 ignored issues
show
Documentation introduced by
'API_DESCRIPTION' is of type string, but the function expects a object<Solvire\Application\unknown>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
60 3
    }
61
62
    public function setAuthScopes($auths)
63
    {
64
        // these should be Auth collection
65
        foreach ($auths as $auth) {
66
            if (! ($auth instanceof Auth))
67
                throw new \Exception("bad auth object");
68
        }
69
    }
70
71
    /**
72
     * (non-PHPdoc)
73
     * 
74
     * @see \Solvire\API\JSONSchema\Schemable::allSet()
75
     */
76 2
    public function allSet()
77
    {
78 2
        return $this->base->allSet();
79
    }
80
81 3
    public function toSchema()
82
    {
83 3
        return $this->base->toSchema();
84
    }
85
}
86