AttachmentFactory::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types = 1);
4
5
/**
6
 * File: AttachmentFactory.php
7
 *
8
 * @author Bartosz Kubicki [email protected]>
9
 * @copyright Copyright (C) 2018 Lizard Media (http://lizardmedia.pl)
10
 */
11
12
namespace LizardMedia\ProductAttachment\Model;
13
14
use \LizardMedia\ProductAttachment\Api\Data\AttachmentFactoryInterface;
15
use \LizardMedia\ProductAttachment\Api\Data\AttachmentInterface;
16
use \Magento\Framework\ObjectManagerInterface;
17
18
/**
19
 * Class AttachmentFactory
20
 * @package LizardMedia\ProductAttachment\Model
21
 */
22
class AttachmentFactory implements AttachmentFactoryInterface
23
{
24
    /**
25
     * @var \Magento\Framework\ObjectManagerInterface
26
     */
27
    private $objectManager;
28
29
30
    /**
31
     * @param \Magento\Framework\ObjectManagerInterface $objectManager
32
     */
33
    public function __construct(ObjectManagerInterface $objectManager)
34
    {
35
        $this->objectManager = $objectManager;
36
    }
37
38
39
    /**
40
     * @param array $data
41
     *
42
     * @return \LizardMedia\ProductAttachment\Api\Data\AttachmentInterface
43
     */
44
    public function create(array $data = [])
45
    {
46
        return $this->objectManager->create(AttachmentInterface::class, $data);
47
    }
48
}
49