Code Duplication    Length = 29-29 lines in 3 locations

src/Strategy/Auth/FormAuthStrategy.php 1 location

@@ 10-38 (lines=29) @@
7
/**
8
 * @author Guillaume Cavana <[email protected]>
9
 */
10
class FormAuthStrategy extends AbstractBaseAuthStrategy
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::FORM_PARAMS => [
33
                $this->options['form_fields'][0] => $this->options['username'],
34
                $this->options['form_fields'][1] => $this->options['password'],
35
            ],
36
        ];
37
    }
38
}
39

src/Strategy/Auth/QueryAuthStrategy.php 1 location

@@ 10-38 (lines=29) @@
7
/**
8
 * @author Guillaume Cavana <[email protected]>
9
 */
10
class QueryAuthStrategy extends AbstractBaseAuthStrategy
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15
    public function configureOptions(OptionsResolver $resolver)
16
    {
17
        parent::configureOptions($resolver);
18
19
        $resolver->setDefaults([
20
            'query_fields' => ['username', 'password'],
21
        ]);
22
23
        $resolver->setRequired(['query_fields']);
24
    }
25
26
    /**
27
     * {@inheritdoc}
28
     */
29
    public function getRequestOptions()
30
    {
31
        return [
32
            \GuzzleHttp\RequestOptions::QUERY => [
33
                $this->options['query_fields'][0] => $this->options['username'],
34
                $this->options['query_fields'][1] => $this->options['password'],
35
            ],
36
        ];
37
    }
38
}
39

src/Strategy/Auth/JsonAuthStrategy.php 1 location

@@ 10-38 (lines=29) @@
7
/**
8
 * @author Guillaume Cavana <[email protected]>
9
 */
10
class JsonAuthStrategy extends AbstractBaseAuthStrategy
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