AttributePopulator::canSet()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 4
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