/** * Prints a Requirement instance */ private function echo_requirement(\Requirement $requirement) { $result = $requirement->isFulfilled() ? 'OK' : ($requirement->isOptional() ? 'WARNING' : 'ERROR'); $data = ''; switch (rtrim(ltrim(str_pad($result, 9)))) { case 'OK': $data .= '<tr class="success">'; break; case 'WARNING': $data .= '<tr class="warning">'; break; case 'ERROR': $data .= '<tr class="danger">'; break; default: $data .= '<tr>'; break; } $data .= '<td>' . str_pad($result, 9) . '</td>'; $data .= '<td>' . $requirement->getTestMessage() . "</td>"; if (!$requirement->isFulfilled()) { $data .= '<td>' . $requirement->getHelpText() . '</td>'; } $data .= '</tr>'; return $data; }
function get_error_message(Requirement $requirement, $lineSize) { if ($requirement->isFulfilled()) { return; } $errorMessage = wordwrap($requirement->getTestMessage(), $lineSize - 3, PHP_EOL . ' ') . PHP_EOL; $errorMessage .= ' > ' . wordwrap($requirement->getHelpText(), $lineSize - 5, PHP_EOL . ' > ') . PHP_EOL; return $errorMessage; }
/** * Prints a Requirement instance */ function echo_requirement(Requirement $requirement) { $result = $requirement->isFulfilled() ? 'OK' : ($requirement->isOptional() ? 'WARNING' : 'ERROR'); echo ' ' . str_pad($result, 9); echo $requirement->getTestMessage() . "\n"; if (!$requirement->isFulfilled()) { echo sprintf(" %s\n\n", $requirement->getHelpText()); } }