* User: jonathandalbertoserranoserrano * Date: 27/11/15 * Time: 1:44 AM */ require_once 'Class/CubeSummation.php'; require_once 'Class/InputValidator.php'; require_once 'Class/View.php'; if (isset($_POST['input'])) { if ($_POST['input'] != '') { $inputObj = new InputValidator(); if ($inputObj->isValid()) { $arrInput = $inputObj->getArrResultInput(); if (is_array($arrInput) && !is_null($arrInput) && !empty($arrInput)) { foreach ($arrInput as $iteration => $inputData) { $cubeSummation = new CubeSummation($inputData['sizeOfMatrix'], $inputData['operations']); $results = $cubeSummation->getArrSum(); $strResult .= implode('<br>', $results) . "<br>"; } } } else { $strErrors = 'Errors: ' . implode('<br>', $inputObj->getErrors()) . "<br>"; } } else { $strErrors = 'Input is empty!<br>'; $strResult = ''; } } else { $strErrors = ''; $strResult = ''; } $view = new View($strErrors, $strResult);