FileFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A build() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the BenGorFile package.
5
 *
6
 * (c) Beñat Espiña <[email protected]>
7
 * (c) Gorka Laucirica <[email protected]>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
namespace BenGorFile\File\Infrastructure\Domain\Model;
14
15
use BenGorFile\File\Domain\Model\File;
16
use BenGorFile\File\Domain\Model\FileFactory as BaseFileFactory;
17
use BenGorFile\File\Domain\Model\FileId;
18
use BenGorFile\File\Domain\Model\FileMimeType;
19
use BenGorFile\File\Domain\Model\FileName;
20
21
/**
22
 * File factory domain class.
23
 *
24
 * @author Beñat Espiña <[email protected]>
25
 */
26
class FileFactory implements BaseFileFactory
27
{
28
    /**
29
     * The entity fully qualified namespace.
30
     *
31
     * @var string
32
     */
33
    private $class;
34
35
    /**
36
     * Constructor.
37
     *
38
     * @param string $aClass The entity fully qualified namespace
39
     */
40
    public function __construct($aClass = File::class)
41
    {
42
        $this->class = $aClass;
43
    }
44
45
    /**
46
     * {@inheritdoc}
47
     */
48
    public function build(FileId $anId, FileName $aName, FileMimeType $aMimeType)
49
    {
50
        return new $this->class($anId, $aName, $aMimeType);
51
    }
52
}
53