GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

FormManager   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
lcom 0
cbo 2
dl 0
loc 47
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A validatePlugin() 0 14 3
A get() 0 11 3
1
<?php
2
/**
3
 * Form manager
4
 *
5
 * @category  StrokerForm
6
 * @package   StrokerForm
7
 * @copyright 2012 Bram Gerritsen
8
 * @version   SVN: $Id$
9
 */
10
11
namespace StrokerForm;
12
13
use Zend\Form\FormInterface;
14
use Zend\ServiceManager\AbstractPluginManager;
15
16
class FormManager extends AbstractPluginManager
17
{
18
    /**
19
     * Validate the plugin
20
     *
21
     * Checks that the filter loaded is either a valid callback or an instance
22
     * of FilterInterface.
23
     *
24
     * @param  mixed $plugin
25
     *
26
     * @return void
27
     * @throws \RuntimeException if invalid
28
     */
29
    public function validatePlugin($plugin)
30
    {
31
        if ($plugin instanceof FormInterface) {
32
            // we're okay
33
            return;
34
        }
35
36
        throw new \RuntimeException(
37
            sprintf(
38
                'Form of type %s is invalid; must implement FormInterface',
39
                (is_object($plugin) ? get_class($plugin) : gettype($plugin))
40
            )
41
        );
42
    }
43
44
    /**
45
     * @param string $name
46
     * @param array  $options
47
     * @param bool   $usePeeringServiceManagers
48
     *
49
     * @return FormInterface
50
     */
51
    public function get($name, $options = [], $usePeeringServiceManagers = true)
52
    {
53
        $formElementManager = $this->getServiceLocator()->get('FormElementManager');
54
        if ($formElementManager->has($name)) {
55
            $form = $formElementManager->get($name);
56
            if ($form instanceof FormInterface) {
57
                return $form;
58
            }
59
        }
60
        return parent::get($name, $options, $usePeeringServiceManagers);
0 ignored issues
show
Bug Compatibility introduced by
The expression parent::get($name, $opti...eeringServiceManagers); of type object|array adds the type array to the return on line 60 which is incompatible with the return type documented by StrokerForm\FormManager::get of type Zend\Form\FormInterface.
Loading history...
61
    }
62
}
63