Answer the question
In order to leave comments, you need to log in
What is the best way to move the logic into a common class?
What is the best way to hide the logic in which thread the class is generic
<?php
require_once "../vendor/autoload.php";
use src\ExchangeRates;
use src\SalaryReporter;
use src\Validator;
$exchangeRates = new ExchangeRates();
$rateDollar = $exchangeRates->getDollar();
$report = null;
$textValidationError = null;
$numberHours = filter_input(INPUT_POST, "numberHours", FILTER_SANITIZE_STRING);
$rate = filter_input(INPUT_POST, "rate", FILTER_SANITIZE_STRING);
$validator = new Validator();
if (isset($numberHours, $rate)) {
$arrayErrors = $validator->check($numberHours, $rate);
if (empty($arrayErrors)) {
$salaryReporter = new SalaryReporter();
$report = $salaryReporter->generateReport($numberHours, $rate, $rateDollar);
} else {
$validationError = $arrayErrors;
}
}
?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question