Fix Pint formatting

This commit is contained in:
root
2026-06-09 01:25:14 -04:00
parent 6be4875c5e
commit 20a0b6c4e5
1485 changed files with 11318 additions and 10273 deletions
+6 -8
View File
@@ -10,9 +10,7 @@ use RuntimeException;
class StaffCommandService
{
public function __construct(private GlobalConfigService $configService)
{
}
public function __construct(private GlobalConfigService $configService) {}
public function create(array $payload): Staff
{
@@ -21,7 +19,7 @@ class StaffCommandService
$roleName = (string) ($payload['role_name'] ?? '');
$activeRole = strtolower($roleName);
if (!empty($payload['status']) && strtolower((string) $payload['status']) === 'inactive') {
if (! empty($payload['status']) && strtolower((string) $payload['status']) === 'inactive') {
$activeRole = 'inactive';
}
@@ -40,7 +38,7 @@ class StaffCommandService
'updated_at' => now(),
]);
if (!$staff) {
if (! $staff) {
throw new RuntimeException('Failed to create staff member.');
}
@@ -61,13 +59,13 @@ class StaffCommandService
if (array_key_exists('role_name', $updates)) {
$updates['active_role'] = strtolower((string) $updates['role_name']);
}
if (!empty($payload['status']) && strtolower((string) $payload['status']) === 'inactive') {
if (! empty($payload['status']) && strtolower((string) $payload['status']) === 'inactive') {
$updates['active_role'] = 'inactive';
}
$updates['updated_at'] = now();
if (!empty($updates)) {
if (! empty($updates)) {
$staff->fill($updates);
$staff->save();
}
@@ -83,7 +81,7 @@ class StaffCommandService
private function resolveUserId(array $payload): int
{
if (!empty($payload['user_id'])) {
if (! empty($payload['user_id'])) {
return (int) $payload['user_id'];
}
+5 -8
View File
@@ -6,14 +6,11 @@ use App\Models\Staff;
use App\Models\TeacherClass;
use App\Models\User;
use App\Services\System\GlobalConfigService;
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
use Illuminate\Support\Facades\DB;
class StaffQueryService
{
public function __construct(private GlobalConfigService $configService)
{
}
public function __construct(private GlobalConfigService $configService) {}
public function paginate(array $filters, int $page, int $perPage): array
{
@@ -22,7 +19,7 @@ class StaffQueryService
$query = Staff::query()
->whereNotIn(DB::raw('LOWER(active_role)'), $excluded);
if (!empty($filters['role'])) {
if (! empty($filters['role'])) {
$role = strtolower(trim((string) $filters['role']));
$query->whereRaw('LOWER(active_role) = ?', [$role]);
}
@@ -47,7 +44,7 @@ class StaffQueryService
if (in_array($role, ['teacher', 'teacher_assistant'], true)) {
$tid = (int) ($staff->user_id ?? 0);
$labels = $assignByTeacher[$tid] ?? [];
if (!empty($labels)) {
if (! empty($labels)) {
$staff->class_section = implode(', ', array_unique($labels));
$staff->verification_issue = false;
} else {
@@ -101,10 +98,10 @@ class StaffQueryService
continue;
}
$pos = strtolower((string) ($row->position ?? ''));
if (!in_array($pos, ['main', 'ta'], true)) {
if (! in_array($pos, ['main', 'ta'], true)) {
continue;
}
$assignByTeacher[$tid][] = $name . ' (' . $pos . ')';
$assignByTeacher[$tid][] = $name.' ('.$pos.')';
}
return $assignByTeacher;
@@ -5,9 +5,11 @@ namespace App\Services\Staff;
class StaffTimeOffLinkService
{
private const TOKEN_CONTEXT = 'timeoff_notify';
private const DEFAULT_TTL = 1209600;
private string $secret;
private int $ttl;
public function __construct(?string $secret = null, ?int $ttlSeconds = null)
@@ -30,12 +32,12 @@ class StaffTimeOffLinkService
public function parseToken(?string $token): ?array
{
if (!is_string($token) || $token === '') {
if (! is_string($token) || $token === '') {
return null;
}
$payload = $this->jwtDecode($token, $this->secret);
if (!is_array($payload)) {
if (! is_array($payload)) {
return null;
}
@@ -77,17 +79,17 @@ class StaffTimeOffLinkService
$payload = json_decode($this->base64UrlDecode($payload64), true);
$signature = $this->base64UrlDecode($signature64);
if (!is_array($header) || !is_array($payload)) {
if (! is_array($header) || ! is_array($payload)) {
return null;
}
$signingInput = $header64 . '.' . $payload64;
$signingInput = $header64.'.'.$payload64;
if (($header['alg'] ?? '') !== 'HS256') {
return null;
}
$expected = hash_hmac('sha256', $signingInput, $secret, true);
if (!hash_equals($expected, $signature)) {
if (! hash_equals($expected, $signature)) {
return null;
}
@@ -105,6 +107,7 @@ class StaffTimeOffLinkService
if ($padding > 0) {
$data .= str_repeat('=', 4 - $padding);
}
return base64_decode(strtr($data, '-_', '+/')) ?: '';
}
}