ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
divideinto.php
Go to the documentation of this file.
1<?php
2
11namespace Matrix;
12
14
22if (!function_exists(__NAMESPACE__ . '\\divideinto')) {
23 function divideinto(...$matrixValues): Matrix
24 {
25 if (count($matrixValues) < 2) {
26 throw new Exception('Division operation requires at least 2 arguments');
27 }
28
29 $matrix = array_pop($matrixValues);
30 $matrixValues = array_reverse($matrixValues);
31
32 if (is_array($matrix)) {
33 $matrix = new Matrix($matrix);
34 }
35 if (!$matrix instanceof Matrix) {
36 throw new Exception('Division arguments must be Matrix or array');
37 }
38
39 $result = new Division($matrix);
40
41 foreach ($matrixValues as $matrix) {
42 $result->execute($matrix);
43 }
44
45 return $result->result();
46 }
47}
$result
An exception for terminatinating execution or to throw for unit testing.
$matrix
Definition: test.php:18
Class for the creating "special" Matrices.
Definition: Builder.php:11