Completed
Push — master ( e1936c...32fb86 )
by Fabian
21s queued 11s
created

CategoryFixture   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 7
c 2
b 0
f 0
dl 0
loc 30
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 3 1
A getCategory() 0 3 1
A getUrlKey() 0 5 1
A __construct() 0 3 1
1
<?php
2
3
namespace TddWizard\Fixtures\Catalog;
4
5
use Magento\Catalog\Api\Data\CategoryInterface;
6
use Magento\Catalog\Model\Category;
7
8
class CategoryFixture
9
{
10
    /**
11
     * @var CategoryInterface
12
     */
13
    private $category;
14
15
    /**
16
     * @return CategoryInterface
17
     */
18
    public function getCategory(): CategoryInterface
19
    {
20
        return $this->category;
21
    }
22
23
    public function __construct(CategoryInterface $category)
24
    {
25
        $this->category = $category;
26
    }
27
28
    public function getId() : int
29
    {
30
        return $this->category->getId();
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->category->getId() could return the type null which is incompatible with the type-hinted return integer. Consider adding an additional type-check to rule them out.
Loading history...
31
    }
32
33
    public function getUrlKey() : string
34
    {
35
        /** @var Category $category */
36
        $category = $this->category;
37
        return $category->getUrlKey();
0 ignored issues
show
Bug Best Practice introduced by
The expression return $category->getUrlKey() could return the type null which is incompatible with the type-hinted return string. Consider adding an additional type-check to rule them out.
Loading history...
38
    }
39
}
40