PHP 8.3.31
Preview: WeekDay.php Size: 2.10 KB
/home/getspomw/royalsquad.us/vendor/nesbot/carbon/src/Carbon/WeekDay.php

<?php

declare(strict_types=1);

/**
 * This file is part of the Carbon package.
 *
 * (c) Brian Nesbitt <brian@nesbot.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Carbon;

use Carbon\Exceptions\InvalidFormatException;

enum WeekDay: int
{
    // Using constants is only safe starting from PHP 8.2
    case Sunday = 0; // CarbonInterface::SUNDAY
    case Monday = 1; // CarbonInterface::MONDAY
    case Tuesday = 2; // CarbonInterface::TUESDAY
    case Wednesday = 3; // CarbonInterface::WEDNESDAY
    case Thursday = 4; // CarbonInterface::THURSDAY
    case Friday = 5; // CarbonInterface::FRIDAY
    case Saturday = 6; // CarbonInterface::SATURDAY

    public static function int(self|int|null $value): ?int
    {
        return $value instanceof self ? $value->value : $value;
    }

    public static function fromNumber(int $number): self
    {
        $day = $number % CarbonInterface::DAYS_PER_WEEK;

        return self::from($day + ($day < 0 ? CarbonInterface::DAYS_PER_WEEK : 0));
    }

    public static function fromName(string $name, ?string $locale = null): self
    {
        try {
            return self::from(CarbonImmutable::parseFromLocale($name, $locale)->dayOfWeek);
        } catch (InvalidFormatException $exception) {
            // Possibly current language expect a dot after short name, but it's missing
            if ($locale !== null && !mb_strlen($name) < 4 && !str_ends_with($name, '.')) {
                try {
                    return self::from(CarbonImmutable::parseFromLocale($name.'.', $locale)->dayOfWeek);
                } catch (InvalidFormatException) {
                    // Throw previous error
                }
            }

            throw $exception;
        }
    }

    public function next(?CarbonImmutable $now = null): CarbonImmutable
    {
        return $now?->modify($this->name) ?? new CarbonImmutable($this->name);
    }

    public function locale(string $locale, ?CarbonImmutable $now = null): CarbonImmutable
    {
        return $this->next($now)->locale($locale);
    }
}

Directory Contents

Dirs: 8 × Files: 21

Name Size Perms Modified Actions
Cli DIR
- drwxrwxrwx 2025-09-17 06:53:16
Edit Download
- drwxrwxrwx 2026-04-21 08:55:54
Edit Download
Lang DIR
- drwxrwxrwx 2025-09-17 06:53:16
Edit Download
Laravel DIR
- drwxrwxrwx 2026-04-22 18:10:15
Edit Download
List DIR
- drwxrwxrwx 2025-09-17 06:53:16
Edit Download
- drwxrwxrwx 2025-09-17 06:53:16
Edit Download
PHPStan DIR
- drwxrwxrwx 2026-04-21 16:07:18
Edit Download
Traits DIR
- drwxrwxrwx 2025-09-17 06:53:17
Edit Download
11.10 KB lrw-rw-rw- 2025-09-17 06:53:13
Edit Download
3.05 KB lrw-rw-rw- 2025-09-17 06:53:13
Edit Download
156.66 KB lrw-rw-rw- 2025-09-17 06:53:13
Edit Download
443 B lrw-rw-rw- 2025-09-17 06:53:13
Edit Download
157.70 KB lrw-rw-rw- 2025-09-17 06:53:13
Edit Download
306.58 KB lrw-rw-rw- 2025-09-17 06:53:13
Edit Download
116.53 KB lrw-rw-rw- 2025-09-17 06:53:13
Edit Download
84.15 KB lrw-rw-rw- 2025-09-17 06:53:13
Edit Download
856 B lrw-rw-rw- 2025-09-17 06:53:13
Edit Download
8.91 KB lrw-rw-rw- 2025-09-17 06:53:13
Edit Download
10.81 KB lrw-r--r-- 2026-04-26 10:16:59
Edit Download
44.47 KB lrw-rw-rw- 2025-09-17 06:53:13
Edit Download
24.28 KB lrw-rw-rw- 2025-09-17 06:53:13
Edit Download
6.42 KB lrw-rw-rw- 2025-09-17 06:53:13
Edit Download
2.49 KB lrw-rw-rw- 2025-09-17 06:53:13
Edit Download
833 B lrw-rw-rw- 2025-09-17 06:53:13
Edit Download
2.35 KB lrw-rw-rw- 2025-09-17 06:53:13
Edit Download
577 B lrw-rw-rw- 2025-09-17 06:53:13
Edit Download
3.32 KB lrw-rw-rw- 2025-09-17 06:53:13
Edit Download
2.10 KB lrw-rw-rw- 2025-09-17 06:53:13
Edit Download
5.09 KB lrw-rw-rw- 2025-09-17 06:53:13
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).