DeviceSessionResolver::resolve()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 23
Code Lines 20

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 20
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 23
rs 9.6
1
<?php
2
3
namespace vasadibt\onesignal\resolver;
4
5
use Symfony\Component\OptionsResolver\OptionsResolver;
6
use yii\base\BaseObject;
0 ignored issues
show
Bug introduced by
The type yii\base\BaseObject was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
8
/**
9
 * Class DeviceSessionResolver
10
 * @package vasadibt\onesignal\resolver
11
 */
12
class DeviceSessionResolver extends BaseObject implements ResolverInterface
13
{
14
    /**
15
     * {@inheritdoc}
16
     */
17
    public function resolve(array $data)
18
    {
19
        return (new OptionsResolver())
20
            ->setDefined('identifier')
21
            ->setAllowedTypes('identifier', 'string')
22
            ->setDefined('language')
23
            ->setAllowedTypes('language', 'string')
24
            ->setDefined('timezone')
25
            ->setAllowedTypes('timezone', 'int')
26
            ->setDefined('game_version')
27
            ->setAllowedTypes('game_version', 'string')
28
            ->setDefined('device_os')
29
            ->setAllowedTypes('device_os', 'string')
30
            // @todo: remove "device_model" later (this option is probably deprecated as it is removed from documentation)
31
            ->setDefined('device_model')
32
            ->setAllowedTypes('device_model', 'string')
33
            ->setDefined('ad_id')
34
            ->setAllowedTypes('ad_id', 'string')
35
            ->setDefined('sdk')
36
            ->setAllowedTypes('sdk', 'string')
37
            ->setDefined('tags')
38
            ->setAllowedTypes('tags', 'array')
39
            ->resolve($data);
40
    }
41
}
42