Code Duplication    Length = 12-12 lines in 2 locations

src/Knp/FriendlyContexts/Http/Security/HttpBasicExtension.php 1 location

@@ 18-29 (lines=12) @@
15
   {
16
   }
17
18
    public function secureRequest(Request $request, RequestBuilder $builder)
19
    {
20
        $credentials = $builder->getCredentials();
21
22
        if (!isset($credentials['username']) || !isset($credentials['password'])) {
23
            throw new \RuntimeException(
24
                'You must specified a "username" and a "password" for the http basic authentication.'
25
            );
26
        }
27
28
        $request->setAuth($credentials['username'], $credentials['password']);
29
    }
30
}
31

src/Knp/FriendlyContexts/Http/Security/HttpExtension.php 1 location

@@ 31-42 (lines=12) @@
28
    /**
29
     * {@inheritdoc}
30
     */
31
    public function secureRequest(Request $request, RequestBuilder $builder)
32
    {
33
        $credentials = $builder->getCredentials();
34
35
        if (!isset($credentials['username']) || !isset($credentials['password'])) {
36
            throw new \RuntimeException(
37
                'You must specified a "username" and a "password" for the http basic authentication.'
38
            );
39
        }
40
41
        $request->setAuth($credentials['username'], $credentials['password'], $this->scheme);
42
    }
43
}
44