| @@ 19-33 (lines=15) @@ | ||
| 16 | ||
| 17 | class Costs extends \ArrayObject |
|
| 18 | { |
|
| 19 | public function __construct($first = null, $second = null, |
|
| 20 | array $third = null) |
|
| 21 | { |
|
| 22 | if (is_array($first)) { |
|
| 23 | $array = array_combine(['insertion', 'replacement', 'deletion'], $first); |
|
| 24 | } else { |
|
| 25 | $array = [ |
|
| 26 | 'insertion' => $first, |
|
| 27 | 'replacement' => $second, |
|
| 28 | 'deletion' => $third, |
|
| 29 | ]; |
|
| 30 | } |
|
| 31 | ||
| 32 | parent::__construct(array_map('intVal', $array), parent::ARRAY_AS_PROPS); |
|
| 33 | } |
|
| 34 | } |
|
| 35 | ||
| @@ 19-34 (lines=16) @@ | ||
| 16 | ||
| 17 | abstract class InputAbstract extends \ArrayObject |
|
| 18 | { |
|
| 19 | public function __construct($first = null, $second = null, |
|
| 20 | array $costs = null) |
|
| 21 | { |
|
| 22 | if (is_array($first)) { |
|
| 23 | $array = array_combine(['first', 'second', 'costs'], $first); |
|
| 24 | } else { |
|
| 25 | $array = [ |
|
| 26 | 'first' => $first, |
|
| 27 | 'second' => $second, |
|
| 28 | 'costs' => $costs, |
|
| 29 | ]; |
|
| 30 | } |
|
| 31 | parent::__construct($array, parent::ARRAY_AS_PROPS); |
|
| 32 | ||
| 33 | $this->constructCosts(); |
|
| 34 | } |
|
| 35 | ||
| 36 | public function setFirst($value) |
|
| 37 | { |
|