SettingApi::show()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
namespace SafeCrow\Api;
3
4
use SafeCrow\DataTransformer\SettingDataTransformer;
5
use SafeCrow\Model\Setting;
6
use Symfony\Component\OptionsResolver\OptionsResolver;
7
8
/**
9
 * Class SettingApi
10
 * @package SafeCrow\Api
11
 */
12
class SettingApi extends AbstractApi
13
{
14
    /**
15
     * @return Setting
16
     */
17
    public function show(): Setting
18
    {
19
        $response = $this->get('/settings');
20
21
        return $this->getResult($response, new SettingDataTransformer());
22
    }
23
24
    /**
25
     * @param array $params
26
     * @return Setting
27
     */
28 View Code Duplication
    public function edit(array $params): Setting
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
29
    {
30
        $resolver = new OptionsResolver();
31
        $resolver
32
            ->setRequired([
33
                'callback_url',
34
            ])
35
            ->setAllowedTypes('callback_url', ['string', 'null']);
36
37
        $params = array_filter($resolver->resolve($params));
38
39
        $response = $this->post('/settings', $params);
40
41
        return $this->getResult($response, new SettingDataTransformer());
42
    }
43
}
44