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

RowData::fromObject()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

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