Completed
Push — master ( 883f28...097345 )
by Vincent
03:45 queued 11s
created

HasVersion   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 7
dl 0
loc 33
ccs 7
cts 7
cp 1
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A fakeVersion() 0 6 1
A setVersion() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace VGirol\JsonApiFaker\Factory;
6
7
trait HasVersion
8
{
9
    /**
10
     * Undocumented variable
11
     *
12
     * @var string
13
     */
14
    public $version;
15
16
    /**
17
     * Undocumented function
18
     *
19
     * @param string $version
20
     * @return static
21
     */
22 4
    public function setVersion(string $version)
23
    {
24 4
        $this->version = $version;
25
26 4
        return $this;
27
    }
28
29
    /**
30
     * Undocumented function
31
     *
32
     * @return static
33
     */
34 2
    public function fakeVersion()
35
    {
36 2
        $faker = \Faker\Factory::create();
37
38 2
        return $this->setVersion(
39 2
            $faker->randomDigitNotNull . '.' . $faker->randomDigit
40
        );
41
    }
42
}
43