ProductFixture   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 63.64%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 30
ccs 7
cts 11
cp 0.6364
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getId() 0 3 1
A getSku() 0 3 1
A getProduct() 0 3 1
A rollback() 0 3 1
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