ColumnsFactory::createService()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 3
Ratio 75 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 3
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace ZfcDatagrid\Renderer\JqGrid\View\Helper;
4
5
use Interop\Container\ContainerInterface;
6
use Zend\ServiceManager\AbstractPluginManager;
7
use Zend\ServiceManager\FactoryInterface;
8
use Zend\ServiceManager\ServiceLocatorInterface;
9
10 View Code Duplication
class ColumnsFactory implements FactoryInterface
0 ignored issues
show
Deprecated Code introduced by
The interface Zend\ServiceManager\FactoryInterface has been deprecated with message: Use Zend\ServiceManager\Factory\FactoryInterface instead.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
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...
11
{
12
    /**
13
     * @param ContainerInterface $container
14
     * @param string             $requestedName
15
     * @param array|null         $options
16
     *
17
     * @return Columns
18
     */
19
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
20
    {
21
        $tableRow = new Columns();
22
        if ($container->has('translator')) {
23
            $tableRow->setTranslator($container->get('translator'));
24
        }
25
26
        return $tableRow;
27
    }
28
29
    /**
30
     * @param ServiceLocatorInterface|AbstractPluginManager $serviceLocator
31
     *
32
     * @return Columns
33
     */
34
    public function createService(ServiceLocatorInterface $serviceLocator)
35
    {
36
        return $this($serviceLocator->getServiceLocator(), Columns::class);
37
    }
38
}
39