fix gitlab tests
This commit is contained in:
@@ -15,16 +15,13 @@ class SlipPrinterFormatterService
|
||||
}
|
||||
if (preg_match('/^\d{1,2}\/\d{1,2}\/\d{4}$/', $value)) {
|
||||
$dt = \DateTime::createFromFormat('!m/d/Y', $value);
|
||||
|
||||
return $dt ? $dt->format('Y-m-d') : null;
|
||||
}
|
||||
if (preg_match('/^\d{1,2}-\d{1,2}-\d{4}$/', $value)) {
|
||||
$dt = \DateTime::createFromFormat('!m-d-Y', $value);
|
||||
|
||||
return $dt ? $dt->format('Y-m-d') : null;
|
||||
}
|
||||
$ts = strtotime($value);
|
||||
|
||||
return $ts ? date('Y-m-d', $ts) : null;
|
||||
}
|
||||
|
||||
@@ -35,7 +32,6 @@ class SlipPrinterFormatterService
|
||||
return null;
|
||||
}
|
||||
$ts = strtotime($value);
|
||||
|
||||
return $ts ? date('H:i:s', $ts) : null;
|
||||
}
|
||||
|
||||
@@ -46,7 +42,6 @@ class SlipPrinterFormatterService
|
||||
return '';
|
||||
}
|
||||
$ts = strtotime($value);
|
||||
|
||||
return $ts ? date('m/d/Y', $ts) : '';
|
||||
}
|
||||
|
||||
@@ -58,9 +53,8 @@ class SlipPrinterFormatterService
|
||||
}
|
||||
$ts = strtotime($value);
|
||||
if ($ts === false) {
|
||||
$ts = strtotime('today '.$value);
|
||||
$ts = strtotime('today ' . $value);
|
||||
}
|
||||
|
||||
return $ts ? date('h:i A', $ts) : '';
|
||||
}
|
||||
|
||||
@@ -70,19 +64,17 @@ class SlipPrinterFormatterService
|
||||
if (strlen($line) > $width) {
|
||||
return substr($line, 0, $width);
|
||||
}
|
||||
|
||||
return $line.str_repeat(' ', $width - strlen($line));
|
||||
return $line . str_repeat(' ', $width - strlen($line));
|
||||
}
|
||||
|
||||
public function buildSlipLines(array $data, int $width): array
|
||||
{
|
||||
$lines = [];
|
||||
$lines[] = $this->fitLine('Student Name: '.(string) ($data['student_name'] ?? ''), $width);
|
||||
$lines[] = $this->fitLine('Date: '.(string) ($data['date'] ?? '').' Time In: '.(string) ($data['time_in'] ?? ''), $width);
|
||||
$lines[] = $this->fitLine('Grade: '.(string) ($data['grade'] ?? ''), $width);
|
||||
$lines[] = $this->fitLine('Reason: '.(string) ($data['reason'] ?? ''), $width);
|
||||
$lines[] = $this->fitLine('Admin: '.(string) ($data['admin_name'] ?? ''), $width);
|
||||
|
||||
$lines[] = $this->fitLine('Student Name: ' . (string) ($data['student_name'] ?? ''), $width);
|
||||
$lines[] = $this->fitLine('Date: ' . (string) ($data['date'] ?? '') . ' Time In: ' . (string) ($data['time_in'] ?? ''), $width);
|
||||
$lines[] = $this->fitLine('Grade: ' . (string) ($data['grade'] ?? ''), $width);
|
||||
$lines[] = $this->fitLine('Reason: ' . (string) ($data['reason'] ?? ''), $width);
|
||||
$lines[] = $this->fitLine('Admin: ' . (string) ($data['admin_name'] ?? ''), $width);
|
||||
return $lines;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user