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

RowData   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 1
cbo 0
dl 0
loc 28
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A fromObject() 0 14 2
A getObject() 0 4 1
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