Completed
Push — ezp25946-migrate_files_to_othe... ( 7b23be...d05e09 )
by
unknown
29:04 queued 15:33
created

MigrationHandler   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 40
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A setIODataHandlersByIdentifiers() 0 13 1
1
<?php
2
3
/**
4
 * File containing the MigrationHandler class.
5
 *
6
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
7
 * @license For full copyright and license information view LICENSE file distributed with this source code.
8
 */
9
namespace eZ\Bundle\EzPublishIOBundle\Migration;
10
11
use eZ\Bundle\EzPublishIOBundle\ApiLoader\HandlerFactory;
12
13
abstract class MigrationHandler implements MigrationHandlerInterface
14
{
15
    /** @var \eZ\Bundle\EzPublishIOBundle\ApiLoader\HandlerFactory */
16
    private $metadataHandlerFactory;
17
18
    /** @var \eZ\Bundle\EzPublishIOBundle\ApiLoader\HandlerFactory */
19
    private $binarydataHandlerFactory;
20
21
    /** @var \eZ\Publish\Core\IO\IOMetadataHandler */
22
    protected $fromMetadataHandler;
23
24
    /** @var \eZ\Publish\Core\IO\IOBinarydataHandler */
25
    protected $fromBinarydataHandler;
26
27
    /** @var \eZ\Publish\Core\IO\IOMetadataHandler */
28
    protected $toMetadataHandler;
29
30
    /** @var \eZ\Publish\Core\IO\IOBinarydataHandler */
31
    protected $toBinarydataHandler;
32
33
    public function __construct(HandlerFactory $metadataHandlerFactory, HandlerFactory $binarydataHandlerFactory)
34
    {
35
        $this->metadataHandlerFactory = $metadataHandlerFactory;
36
        $this->binarydataHandlerFactory = $binarydataHandlerFactory;
37
    }
38
39
    public function setIODataHandlersByIdentifiers(
40
        $fromMetadataHandlerIdentifier,
41
        $fromBinarydataHandlerIdentifier,
42
        $toMetadataHandlerIdentifier,
43
        $toBinarydataHandlerIdentifier
44
    ) {
45
        $this->fromMetadataHandler = $this->metadataHandlerFactory->getConfiguredHandler($fromMetadataHandlerIdentifier);
46
        $this->fromBinarydataHandler = $this->binarydataHandlerFactory->getConfiguredHandler($fromBinarydataHandlerIdentifier);
47
        $this->toMetadataHandler = $this->metadataHandlerFactory->getConfiguredHandler($toMetadataHandlerIdentifier);
48
        $this->toBinarydataHandler = $this->binarydataHandlerFactory->getConfiguredHandler($toBinarydataHandlerIdentifier);
49
50
        return $this;
51
    }
52
}
53