RecaptchaFactory   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 20
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 5 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Acelaya\Website\Factory;
5
6
use Interop\Container\ContainerInterface;
7
use Interop\Container\Exception\ContainerException;
8
use ReCaptcha\ReCaptcha;
9
use Zend\ServiceManager\Exception\ServiceNotCreatedException;
10
use Zend\ServiceManager\Exception\ServiceNotFoundException;
11
use Zend\ServiceManager\Factory\FactoryInterface;
12
13
class RecaptchaFactory implements FactoryInterface
14
{
15
    /**
16
     * Create an object
17
     *
18
     * @param  ContainerInterface $container
19
     * @param  string $requestedName
20
     * @param  null|array $options
21
     * @return object|ReCaptcha
22
     * @throws ServiceNotFoundException if unable to resolve the service.
23
     * @throws ServiceNotCreatedException if an exception is raised when
24
     *     creating a service.
25 1
     * @throws ContainerException if any other error occurs
26
     */
27 1
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null): ReCaptcha
28 1
    {
29
        $recaptchaConfig = $container->get('config')['recaptcha'];
30
        return new ReCaptcha($recaptchaConfig['private_key']);
31
    }
32
}
33