Passed
Pull Request — master (#53)
by Kevin
20:12
created

CategoryServiceFactory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 6
c 1
b 0
f 0
dl 0
loc 19
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getClass() 0 3 1
A __construct() 0 5 1
A getDefaults() 0 3 1
1
<?php
2
3
namespace Zenstruck\Foundry\Tests\Fixtures\Factories;
4
5
use Zenstruck\Foundry\ModelFactory;
6
use Zenstruck\Foundry\Tests\Fixtures\Entity\Category;
7
use Zenstruck\Foundry\Tests\Fixtures\Service;
8
9
/**
10
 * @author Kevin Bond <[email protected]>
11
 */
12
final class CategoryServiceFactory extends ModelFactory
13
{
14
    private $service;
15
16
    public function __construct(Service $service)
17
    {
18
        parent::__construct();
19
20
        $this->service = $service;
21
    }
22
23
    protected static function getClass(): string
24
    {
25
        return Category::class;
26
    }
27
28
    protected function getDefaults(): array
29
    {
30
        return ['name' => $this->service->name];
31
    }
32
}
33