Completed
Push — master ( 43dae8...61751c )
by Fabian
24s queued 11s
created

ProductFixture::getProduct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
1
<?php
2
declare(strict_types=1);
3
4
namespace TddWizard\Fixtures\Catalog;
5
6
use Magento\Catalog\Api\Data\ProductInterface;
7
8
class ProductFixture
9
{
10
    /**
11
     * @var ProductInterface
12
     */
13
    private $product;
14
15 19
    public function __construct(ProductInterface $product)
16
    {
17 19
        $this->product = $product;
18 19
    }
19
20
    public function getProduct(): ProductInterface
21
    {
22
        return $this->product;
23
    }
24
25 7
    public function getId(): int
26
    {
27 7
        return (int) $this->product->getId();
28
    }
29
30 18
    public function getSku(): string
31
    {
32 18
        return $this->product->getSku();
33
    }
34
35
    public function rollback(): void
36
    {
37
        ProductFixtureRollback::create()->execute($this);
38
    }
39
}
40