Completed
Push — develop ( da7aa8...3d4c5c )
by greg
09:02
created

Recaptcha::recaptcha()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 4
loc 4
rs 10
c 1
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace PlaygroundCore\Controller\Plugin;
4
5
use Zend\Mvc\Controller\Plugin\AbstractPlugin;
6
use Zend\ServiceManager\ServiceLocatorInterface;
7
8 View Code Duplication
class Recaptcha extends AbstractPlugin
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
9
{
10
    /**
11
     * @var ServiceLocator
12
     */
13
    protected $serviceLocator;
14
15
    /**
16
     * @var service
17
     */
18
    protected $service;
19
20
    public function __construct(ServiceLocatorInterface $locator)
21
    {
22
        $this->serviceLocator = $locator;
0 ignored issues
show
Documentation Bug introduced by
It seems like $locator of type object<Zend\ServiceManag...erviceLocatorInterface> is incompatible with the declared type object<PlaygroundCore\Co...\Plugin\ServiceLocator> of property $serviceLocator.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
23
    }
24
25
    /**
26
     * Returns the Google ReCaptcha result
27
     *
28
     * @param string $response
29
     */
30
    public function recaptcha($response)
31
    {
32
        return $this->getService()->recaptcha($response);
33
    }
34
35
    /**
36
     * set service
37
     *
38
     * @param  $service
39
     * @return String
40
     */
41
    public function setService($service)
42
    {
43
        $this->service = $service;
44
45
        return $this;
46
    }
47
48
    /**
49
     * get mapper
50
     *
51
     * @return Service
52
     */
53
    public function getService()
54
    {
55
        if (!$this->service) {
56
            $this->setService($this->serviceLocator->get('playgroundcore_recaptcha_service'));
57
        }
58
59
        return $this->service;
60
    }
61
}
62