Completed
Push — ezp25946-migrate_files_to_othe... ( e1d3cb...7924de )
by
unknown
12:27
created

FileLister   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getSPIBinaryForMetadata() 0 12 2
1
<?php
2
3
/**
4
 * File containing the FileLister 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\FileLister;
10
11
use eZ\Bundle\EzPublishIOBundle\Migration\FileListerInterface;
12
use eZ\Bundle\EzPublishIOBundle\Migration\MigrationHandler;
13
use eZ\Publish\SPI\IO\BinaryFile;
14
15
abstract class FileLister extends MigrationHandler implements FileListerInterface
16
{
17
    protected function getSPIBinaryForMetadata($metadata)
18
    {
19
        $spiBinaryFile = new BinaryFile();
20
        $spiBinaryFile->id = $metadata['path'];
21
        $spiBinaryFile->size = $metadata['size'];
22
23
        if (isset($metadata['timestamp'])) {
24
            $spiBinaryFile->mtime = new \DateTime('@' . $metadata['timestamp']);
25
        }
26
27
        return $spiBinaryFile;
28
    }
29
}
30