AttributePopulator   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 20
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A canSet() 0 4 1
A set() 0 4 1
1
<?php
2
3
namespace Ck\Laravel\Alice\Populator\Methods;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Nelmio\Alice\Fixtures\Fixture;
7
use Nelmio\Alice\Instances\Populator\Methods\MethodInterface;
8
9
class AttributePopulator implements MethodInterface
10
{
11
    public function canSet(Fixture $fixture, $object, $property, $value)
12
    {
13
        return $object instanceof Model;
14
    }
15
16
    /**
17
     * Sets the property to the value on the object described by the given fixture.
18
     *
19
     * @param Fixture $fixture
20
     * @param mixed $object
21
     * @param string $property
22
     * @param mixed $value
23
     */
24
    public function set(Fixture $fixture, $object, $property, $value)
25
    {
26
        $object->setAttribute($property, $value);
27
    }
28
}
29