Conditions | 6 |
Paths | 4 |
Total Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
51 | protected function addIndex($string, $index) |
||
52 | { |
||
53 | if (empty($string)) { |
||
54 | throw new InvalidNameException('Name attribute not defined for class ' . get_class($this)); |
||
55 | } |
||
56 | |||
57 | if (strpos($string, $this->indexPlaceholder) !== false) { |
||
58 | if (!is_numeric($index) || $index < $this->minIndex() || $index > $this->maxIndex()) { |
||
59 | throw new InvalidIndexException( |
||
60 | 'When setting parameter ' . get_class($this) |
||
61 | . ' a numeric index between 1 - 200 must be passed for the second argument' |
||
62 | ); |
||
63 | } |
||
64 | } |
||
65 | |||
66 | return str_replace($this->indexPlaceholder, $index, $string); |
||
67 | } |
||
68 | } |
||
69 |