|
|
@@ -1,11 +1,17 @@
|
|
|
-<?php
|
|
|
+<?php /** @noinspection PhpUnhandledExceptionInspection */
|
|
|
+
|
|
|
+/**
|
|
|
+ * @var string $id
|
|
|
+ */
|
|
|
|
|
|
-use \Mpdf\Mpdf;
|
|
|
+use Mpdf\Mpdf;
|
|
|
|
|
|
// Controller may be included directly and $pdf can be accessed.
|
|
|
|
|
|
$test = Test::get($id);
|
|
|
-if(!$test) throw new Exception(__("Test not found."));
|
|
|
+if(!$test) {
|
|
|
+ throw new RuntimeException(__("Test not found."));
|
|
|
+}
|
|
|
|
|
|
$project = $test->getProject();
|
|
|
$customer = $project->getCustomer();
|
|
|
@@ -36,12 +42,12 @@ foreach($test_values as $value) {
|
|
|
$values[$value->name] = $value->value;
|
|
|
}
|
|
|
|
|
|
-$values = array_filter($values, function($value) {
|
|
|
+$values = array_filter($values, static function($value) {
|
|
|
return strlen($value) !== 0;
|
|
|
});
|
|
|
|
|
|
-list($date_start, $time_start) = explode(" ", $test->dts_start);
|
|
|
-list($date_end, $time_end) = explode(" ", $test->dts_end);
|
|
|
+[$date_start, $time_start] = explode(" ", $test->dts_start);
|
|
|
+[$date_end, $time_end] = explode(" ", $test->dts_end);
|
|
|
|
|
|
$dt_start = new DateTime($test->dts_start . " UTC");
|
|
|
$dt_start->setTimezone(new DateTimeZone(TIMEZONE));
|