Passed
Push — master ( 924ca4...27c581 )
by Rodrigo
02:18
created

OneDocAuth::__invoke()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 13
rs 10
cc 2
nc 2
nop 0
1
<?php 
2
3
namespace dynamikaweb\api;
4
5
class OneDocAuth extends \yii\base\Model
6
{ 
7
    public $client_auth;
8
    public $token; 
9
    public $secret;
10
11
    public function __invoke()
12
    {
13
        $auth = [
14
            'client_auth' => $this->client_auth,
15
            'token' => $this->token,
16
            'secret' => $this->secret
17
        ];
18
19
        if( ($index = array_search( null, $auth )) !== false ){
20
            throw new OneDocException("Autenticação Incompleta!\nNão foi encontrado: ".$index);
21
        }
22
    
23
        return $auth;
24
    }
25
26
}