| 1 | <?php |
||
| 5 | class Math implements \Transphporm\TSSFunction { |
||
| 6 | private $mode; |
||
| 7 | |||
| 8 | const ADD = 1; |
||
| 9 | const SUBTRACT = 2; |
||
| 10 | const MULTIPLY = 3; |
||
| 11 | const DIVIDE = 4; |
||
| 12 | |||
| 13 | public function __construct($mode) { |
||
| 16 | |||
| 17 | public function run(array $args, \DomElement $element) { |
||
| 22 | |||
| 23 | private function getModeResult($val, $prev) { |
||
| 35 | } |
||
| 36 |
If the size of the collection does not change during the iteration, it is generally a good practice to compute it beforehand, and not on each iteration: