Completed
Pull Request — master (#4)
by
unknown
06:23
created

JsonAuthStrategy::configureOptions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 10
Ratio 100 %

Importance

Changes 0
Metric Value
dl 10
loc 10
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 1
1
<?php
2
3
namespace Eljam\GuzzleJwt\Strategy\Auth;
4
5
use Symfony\Component\OptionsResolver\OptionsResolver;
6
7
/**
8
 * @author Guillaume Cavana <[email protected]>
9
 */
10 View Code Duplication
class JsonAuthStrategy extends AbstractBaseAuthStrategy
0 ignored issues
show
Duplication introduced by
This class 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...
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15
    public function configureOptions(OptionsResolver $resolver)
16
    {
17
        parent::configureOptions($resolver);
18
19
        $resolver->setDefaults([
20
            'form_fields' => ['_username', '_password'],
21
        ]);
22
23
        $resolver->setRequired(['form_fields']);
24
    }
25
26
    /**
27
     * {@inheritdoc}
28
     */
29
    public function getRequestOptions()
30
    {
31
        return [
32
            \GuzzleHttp\RequestOptions::JSON => [
33
                $this->options['form_fields'][0] => $this->options['username'],
34
                $this->options['form_fields'][1] => $this->options['password'],
35
            ],
36
        ];
37
    }
38
}
39