Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
100.00% |
1 / 1 |
|
100.00% |
10 / 10 |
CRAP | |
100.00% |
19 / 19 |
Index | |
100.00% |
1 / 1 |
|
100.00% |
10 / 10 |
11 | |
100.00% |
19 / 19 |
__construct | |
100.00% |
1 / 1 |
1 | |
100.00% |
3 / 3 |
|||
newIndexPart | |
100.00% |
1 / 1 |
1 | |
100.00% |
3 / 3 |
|||
update | |
100.00% |
1 / 1 |
2 | |
100.00% |
3 / 3 |
|||
getName | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
setName | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
getIsUnique | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
setIsUnique | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
getIndexType | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
setIndexType | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
getIndexPartList | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
<?php | |
declare(strict_types = 1); | |
namespace Siesta\Model; | |
/** | |
* @author Gregor Müller | |
*/ | |
class Index | |
{ | |
/** | |
* @var Entity | |
*/ | |
protected $entity; | |
/** | |
* @var string | |
*/ | |
protected $name; | |
/** | |
* @var bool | |
*/ | |
protected $isUnique; | |
/** | |
* @var string | |
*/ | |
protected $indexType; | |
/** | |
* @var IndexPart[] | |
*/ | |
protected $indexPartList; | |
/** | |
* Index constructor. | |
* | |
* @param Entity $entity | |
*/ | |
public function __construct(Entity $entity) | |
{ | |
$this->entity = $entity; | |
$this->indexPartList = []; | |
} | |
/** | |
* @return IndexPart | |
*/ | |
public function newIndexPart() : IndexPart | |
{ | |
$indexPart = new IndexPart($this->entity); | |
$this->indexPartList[] = $indexPart; | |
return $indexPart; | |
} | |
/** | |
* | |
*/ | |
public function update() | |
{ | |
foreach ($this->indexPartList as $indexPart) { | |
$indexPart->update(); | |
} | |
} | |
/** | |
* @return string | |
*/ | |
public function getName() | |
{ | |
return $this->name; | |
} | |
/** | |
* @param string $name | |
*/ | |
public function setName($name) | |
{ | |
$this->name = $name; | |
} | |
/** | |
* @return boolean | |
*/ | |
public function getIsUnique() | |
{ | |
return $this->isUnique; | |
} | |
/** | |
* @param boolean $isUnique | |
*/ | |
public function setIsUnique($isUnique) | |
{ | |
$this->isUnique = $isUnique; | |
} | |
/** | |
* @return string | |
*/ | |
public function getIndexType() | |
{ | |
return strtolower($this->indexType); | |
} | |
/** | |
* @param string $indexType | |
*/ | |
public function setIndexType($indexType) | |
{ | |
$this->indexType = $indexType; | |
} | |
/** | |
* @return IndexPart[] | |
*/ | |
public function getIndexPartList() | |
{ | |
return $this->indexPartList; | |
} | |
} |