These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace SocialiteProviders\Manager; |
||
4 | |||
5 | use Illuminate\Support\Arr; |
||
6 | use SocialiteProviders\Manager\Contracts\ConfigInterface; |
||
7 | |||
8 | trait ConfigTrait |
||
9 | { |
||
10 | /** |
||
11 | * @var array |
||
12 | */ |
||
13 | protected $config; |
||
14 | |||
15 | /** |
||
16 | * @param \SocialiteProviders\Manager\Contracts\OAuth1\ProviderInterface|\SocialiteProviders\Manager\Contracts\OAuth2\ProviderInterface $config |
||
17 | */ |
||
18 | public function setConfig(ConfigInterface $config) |
||
19 | { |
||
20 | $config = $config->get(); |
||
21 | |||
22 | $this->config = $config; |
||
23 | $this->clientId = $config['client_id']; |
||
0 ignored issues
–
show
|
|||
24 | $this->clientSecret = $config['client_secret']; |
||
0 ignored issues
–
show
The property
clientSecret does not exist. Did you maybe forget to declare it?
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code: class MyClass { }
$x = new MyClass();
$x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: class MyClass {
public $foo;
}
$x = new MyClass();
$x->foo = true;
Loading history...
|
|||
25 | $this->redirectUrl = $config['redirect']; |
||
0 ignored issues
–
show
The property
redirectUrl does not exist. Did you maybe forget to declare it?
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code: class MyClass { }
$x = new MyClass();
$x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: class MyClass {
public $foo;
}
$x = new MyClass();
$x->foo = true;
Loading history...
|
|||
26 | |||
27 | return $this; |
||
28 | } |
||
29 | |||
30 | /** |
||
31 | * @return array |
||
32 | */ |
||
33 | public static function additionalConfigKeys() |
||
34 | { |
||
35 | return []; |
||
36 | } |
||
37 | |||
38 | /** |
||
39 | * @param string $key |
||
40 | * @param mixed $default |
||
41 | * |
||
42 | * @return mixed|array |
||
43 | */ |
||
44 | protected function getConfig($key = null, $default = null) |
||
45 | { |
||
46 | // check manually if a key is given and if it exists in the config |
||
47 | // this has to be done to check for spoofed additional config keys so that null isn't returned |
||
48 | if (!empty($key) && empty($this->config[$key])) { |
||
49 | return $default; |
||
50 | } |
||
51 | |||
52 | return $key ? Arr::get($this->config, $key, $default) : $this->config; |
||
53 | } |
||
54 | } |
||
55 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: