Completed
Push — master ( c11d86...d758ed )
by Gianluca
13:50
created

AuthenticationServiceFactory::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
ccs 5
cts 5
cp 1
rs 9.4285
cc 1
eloc 4
nc 1
nop 3
crap 1
1
<?php
2
/*
3
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
5
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
6
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
7
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
10
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
11
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
12
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
13
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14
 *
15
 * This software consists of voluntary contributions made by many individuals
16
 * and is licensed under the MIT license. For more information, see
17
 * <http://www.doctrine-project.org>.
18
 */
19
namespace DoctrineModule\Service\Authentication;
20
21
use DoctrineModule\Service\AbstractFactory;
22
use Interop\Container\ContainerInterface;
23
use Zend\Authentication\AuthenticationService;
24
use Zend\ServiceManager\ServiceLocatorInterface;
25
26
/**
27
 * Factory to create authentication service object.
28
 *
29
 * @license MIT
30
 * @link    http://www.doctrine-project.org/
31
 * @since   0.1.0
32
 * @author  Tim Roediger <[email protected]>
33
 */
34
class AuthenticationServiceFactory extends AbstractFactory
35
{
36
    /**
37
     * {@inheritDoc}
38
     */
39 1
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
40
    {
41 1
        return new AuthenticationService(
42 1
            $container->get('doctrine.authenticationstorage.' . $this->getName()),
43 1
            $container->get('doctrine.authenticationadapter.' . $this->getName())
44 1
        );
45
    }
46
47
    /**
48
     *
49
     * @param \Zend\ServiceManager\ServiceLocatorInterface $container
50
     * @return \Zend\Authentication\AuthenticationService
51
     */
52 1
    public function createService(ServiceLocatorInterface $container)
53
    {
54 1
        return $this($container, AuthenticationService::class);
55
    }
56
57
    /**
58
     * {@inheritDoc}
59
     */
60
    public function getOptionsClass()
61
    {
62
        throw new \BadMethodCallException('Not implemented');
63
    }
64
}
65