Row   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 75
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 3
Bugs 0 Features 1
Metric Value
wmc 6
c 3
b 0
f 1
lcom 0
cbo 1
dl 0
loc 75
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A set() 0 9 2
A getAttributes() 0 4 1
A setAttributes() 0 6 1
A getType() 0 4 1
A setType() 0 6 1
1
<?php
2
/**
3
 * @package    Fuel\Common
4
 * @version    2.0
5
 * @author     Fuel Development Team
6
 * @license    MIT License
7
 * @copyright  2010 - 2015 Fuel Development Team
8
 * @link       http://fuelphp.com
9
 */
10
11
namespace Fuel\Common\Table;
12
13
use Fuel\Common\DataContainer;
14
15
/**
16
 * Defines a Row that contains Cells for a table.
17
 *
18
 * @package Fuel\Common
19
 *
20
 * @since 2.0
21
 */
22
class Row extends DataContainer
23
{
24
	/**
25
	 * @var array
26
	 */
27
	protected $attributes = [];
28
29
	/**
30
	 * @var integer
31
	 */
32
	protected $type = EnumRowType::Body;
33
34
	/**
35
	 * Overrides the set method from DataContainer to ensure only Cells can be added
36
	 *
37
	 * @throws \InvalidArgumentException
38
	 */
39
	public function set($key, $value)
40
	{
41
		if ( !$value instanceof Cell )
42
		{
43
			throw new \InvalidArgumentException('Only Cells can be added to Rows');
44
		}
45
46
		parent::set($key, $value);
47
	}
48
49
	/**
50
	 * Returns the attributes of this Row
51
	 *
52
	 * @return array
53
	 */
54
	public function getAttributes()
55
	{
56
		return $this->attributes;
57
	}
58
59
	/**
60
	 * Sets the atributes of the Row
61
	 *
62
	 * @param array $newAttributes
63
	 *
64
	 * @return $this
65
	 */
66
	public function setAttributes(array $newAttributes)
67
	{
68
		$this->attributes = $newAttributes;
69
70
		return $this;
71
	}
72
73
	/**
74
	 * Returns the type of the row as defined by EnumRowType
75
	 *
76
	 * @return integer
77
	 */
78
	public function getType()
79
	{
80
		return $this->type;
81
	}
82
83
	/**
84
	 * Sets the type of the row. Should be a value from EnumRowType
85
	 *
86
	 * @param integer $type
87
	 *
88
	 * @return $this
89
	 */
90
	public function setType($type)
91
	{
92
		$this->type = $type;
93
94
		return $this;
95
	}
96
}
97