Completed
Pull Request — master (#39)
by
unknown
02:27
created

ArticleTableGatewayFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 12 1
1
<?php
2
3
namespace Admin\Factory\Db;
4
5
use Admin\Model\Entity\ArticleEntity;
6
use Interop\Container\ContainerInterface;
7
use Zend\Db\Adapter\AdapterInterface;
8
use Zend\Db\ResultSet\HydratingResultSet;
9
use Zend\Hydrator\ArraySerializable;
10
use Admin\Db\ArticleTableGateway;
11
12
class ArticleTableGatewayFactory
13
{
14
    /**
15
     * @param ContainerInterface $container
16
     * @return ArticleTableGateway
17
     */
18
    public function __invoke(ContainerInterface $container)
19
    {
20
        $resultSetPrototype = new HydratingResultSet(
21
            new ArraySerializable(),
22
            new ArticleEntity()
23
        );
24
25
        return new ArticleTableGateway(
26
            $container->get(AdapterInterface::class),
27
            $resultSetPrototype
28
        );
29
    }
30
}