Passed
Pull Request — master (#153)
by Kevin
03:19
created

PostFactory   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 7
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 published() 0 4 1
A getDefaults() 0 5 1
1
<?php
2
3
namespace Zenstruck\Foundry\Tests\Fixtures\Factories\ODM;
4
5
use Zenstruck\Foundry\ModelFactory;
6
use Zenstruck\Foundry\Tests\Fixtures\Document\Post;
7
8
class PostFactory extends ModelFactory
9
{
10
    public function published(): self
11
    {
12
        return $this->addState(function() {
13
            return ['published_at' => self::faker()->dateTime()];
14
        });
15
    }
16
17
    protected static function getClass(): string
18
    {
19
        return Post::class;
20
    }
21
22
    protected function getDefaults(): array
23
    {
24
        return [
25
            'title' => self::faker()->sentence(),
26
            'body' => self::faker()->sentence(),
27
        ];
28
    }
29
}
30