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

MigrationHandler::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 2
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
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