Completed
Pull Request — master (#143)
by
unknown
02:35
created

ContactUsMapperFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 52.94 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 5
dl 9
loc 17
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 9 9 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace ContactUs\Mapper;
4
5
use Interop\Container\ContainerInterface;
6
use ContactUs\Entity\ContactUs;
7
use Zend\Db\Adapter\Adapter;
8
use Zend\Db\ResultSet\HydratingResultSet;
9
use Zend\Hydrator\ArraySerializable;
10
11
/**
12
 * Class ContactUsMapperFactory
13
 *
14
 * @package ContactUs\Mapper
15
 * @author  Djordje Stojiljkovic <[email protected]>
16
 */
17
class ContactUsMapperFactory
18
{
19
    /**
20
     * @param  ContainerInterface $container
21
     *
22
     * @return ContactUsMapper
23
     */
24 View Code Duplication
    public function __invoke(ContainerInterface $container): ContactUsMapper
0 ignored issues
show
Duplication introduced by
This method 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...
25
    {
26
        $adapter   = $container->get(Adapter::class);
27
        $resultSet = new HydratingResultSet(
28
            new ArraySerializable(), new ContactUs()
29
        );
30
31
        return new ContactUsMapper($adapter, $resultSet);
32
    }
33
}