Completed
Pull Request — master (#21)
by Daniel
02:31
created

RowData::getObject()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Psi\Component\Grid;
6
7
use Symfony\Component\Form\FormView;
8
9
/**
10
 * TODO: Tests for this class.
11
 */
12
final class RowData
13
{
14
    private $object;
15
16
    private function __construct()
17
    {
18
    }
19
20
    public static function fromObject($object): RowData
21
    {
22
        if (!is_object($object)) {
23
            throw new \InvalidArgumentException(sprintf(
24
                'Object must be an object, got: "%s"',
25
                gettype($object)
26
            ));
27
        }
28
29
        $instance = new self();
30
        $instance->object = $object;
31
32
        return $instance;
33
    }
34
35
    public function getObject()
36
    {
37
        return $this->object;
38
    }
39
}
40