Completed
Push — master ( 7fcbe3...50e2ca )
by Guillaume
23:24
created

QueryAuthStrategy::configureOptions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 10
rs 9.4285
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
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