PHP 8.3.31
Preview: EnvironmentDetector.php Size: 1.89 KB
/home/getspomw/royalsquad.us/vendor/laravel/framework/src/Illuminate/Foundation/EnvironmentDetector.php

<?php

namespace Illuminate\Foundation;

use Closure;

class EnvironmentDetector
{
    /**
     * Detect the application's current environment.
     *
     * @param  \Closure  $callback
     * @param  array|null  $consoleArgs
     * @return string
     */
    public function detect(Closure $callback, $consoleArgs = null)
    {
        if ($consoleArgs) {
            return $this->detectConsoleEnvironment($callback, $consoleArgs);
        }

        return $this->detectWebEnvironment($callback);
    }

    /**
     * Set the application environment for a web request.
     *
     * @param  \Closure  $callback
     * @return string
     */
    protected function detectWebEnvironment(Closure $callback)
    {
        return $callback();
    }

    /**
     * Set the application environment from command-line arguments.
     *
     * @param  \Closure  $callback
     * @param  array  $args
     * @return string
     */
    protected function detectConsoleEnvironment(Closure $callback, array $args)
    {
        // First we will check if an environment argument was passed via console arguments
        // and if it was that automatically overrides as the environment. Otherwise, we
        // will check the environment as a "web" request like a typical HTTP request.
        if (! is_null($value = $this->getEnvironmentArgument($args))) {
            return $value;
        }

        return $this->detectWebEnvironment($callback);
    }

    /**
     * Get the environment argument from the console.
     *
     * @param  array  $args
     * @return string|null
     */
    protected function getEnvironmentArgument(array $args)
    {
        foreach ($args as $i => $value) {
            if ($value === '--env') {
                return $args[$i + 1] ?? null;
            }

            if (str_starts_with($value, '--env=')) {
                return head(array_slice(explode('=', $value), 1));
            }
        }
    }
}

Directory Contents

Dirs: 17 × Files: 19

Name Size Perms Modified Actions
Auth DIR
- drwxrwxrwx 2025-09-17 06:52:55
Edit Download
Bootstrap DIR
- drwxrwxrwx 2025-09-17 06:52:56
Edit Download
Bus DIR
- drwxrwxrwx 2025-09-17 06:52:56
Edit Download
Concerns DIR
- drwxrwxrwx 2025-09-17 06:52:55
Edit Download
- drwxrwxrwx 2025-09-17 06:52:56
Edit Download
Console DIR
- drwxrwxrwx 2025-09-17 06:52:55
Edit Download
Events DIR
- drwxrwxrwx 2025-09-17 06:52:55
Edit Download
- drwxrwxrwx 2025-09-17 06:52:55
Edit Download
Http DIR
- drwxrwxrwx 2025-09-17 06:52:56
Edit Download
Providers DIR
- drwxrwxrwx 2025-09-17 06:52:55
Edit Download
Queue DIR
- drwxrwxrwx 2025-09-17 06:52:55
Edit Download
resources DIR
- drwxrwxrwx 2025-09-17 06:52:55
Edit Download
Routing DIR
- drwxrwxrwx 2025-09-17 06:52:56
Edit Download
stubs DIR
- drwxrwxrwx 2025-09-17 06:52:55
Edit Download
Support DIR
- drwxrwxrwx 2025-09-17 06:52:56
Edit Download
Testing DIR
- drwxrwxrwx 2025-09-17 06:52:55
Edit Download
- drwxrwxrwx 2025-09-17 06:52:55
Edit Download
5.04 KB lrw-rw-rw- 2025-09-17 06:52:55
Edit Download
45.33 KB lrw-rw-rw- 2025-09-17 06:52:55
Edit Download
2.06 KB lrw-rw-rw- 2025-09-17 06:52:54
Edit Download
4.21 KB lrw-rw-rw- 2025-09-17 06:52:54
Edit Download
1.61 KB lrw-rw-rw- 2025-09-17 06:52:55
Edit Download
1.89 KB lrw-rw-rw- 2025-09-17 06:52:54
Edit Download
1.39 KB lrw-rw-rw- 2025-09-17 06:52:55
Edit Download
26.90 KB lrw-rw-rw- 2025-09-17 06:52:54
Edit Download
6.59 KB lrw-rw-rw- 2025-09-17 06:52:54
Edit Download
1.14 KB lrw-rw-rw- 2025-09-17 06:52:55
Edit Download
2.16 KB lrw-rw-rw- 2025-09-17 06:52:54
Edit Download
117 B lrw-rw-rw- 2025-09-17 06:52:55
Edit Download
121 B lrw-rw-rw- 2025-09-17 06:52:55
Edit Download
4.38 KB lrw-rw-rw- 2025-09-17 06:52:54
Edit Download
574 B lrw-rw-rw- 2025-09-17 06:52:54
Edit Download
6.24 KB lrw-rw-rw- 2025-09-17 06:52:55
Edit Download
28.77 KB lrw-rw-rw- 2025-09-17 06:52:54
Edit Download
106 B lrw-rw-rw- 2025-09-17 06:52:54
Edit Download
151 B lrw-rw-rw- 2025-09-17 06:52:54
Edit Download

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