PHP 8.3.31
Preview: RouteAction.php Size: 3.38 KB
/home/getspomw/royalsquad.us/vendor/laravel/framework/src/Illuminate/Routing/RouteAction.php

<?php

namespace Illuminate\Routing;

use Illuminate\Support\Arr;
use Illuminate\Support\Reflector;
use Illuminate\Support\Str;
use LogicException;
use UnexpectedValueException;

class RouteAction
{
    /**
     * Parse the given action into an array.
     *
     * @param  string  $uri
     * @param  mixed  $action
     * @return array
     */
    public static function parse($uri, $action)
    {
        // If no action is passed in right away, we assume the user will make use of
        // fluent routing. In that case, we set a default closure, to be executed
        // if the user never explicitly sets an action to handle the given uri.
        if (is_null($action)) {
            return static::missingAction($uri);
        }

        // If the action is already a Closure instance, we will just set that instance
        // as the "uses" property, because there is nothing else we need to do when
        // it is available. Otherwise we will need to find it in the action list.
        if (Reflector::isCallable($action, true)) {
            return ! is_array($action) ? ['uses' => $action] : [
                'uses' => $action[0].'@'.$action[1],
                'controller' => $action[0].'@'.$action[1],
            ];
        }

        // If no "uses" property has been set, we will dig through the array to find a
        // Closure instance within this list. We will set the first Closure we come
        // across into the "uses" property that will get fired off by this route.
        elseif (! isset($action['uses'])) {
            $action['uses'] = static::findCallable($action);
        }

        if (! static::containsSerializedClosure($action) && is_string($action['uses']) && ! str_contains($action['uses'], '@')) {
            $action['uses'] = static::makeInvokable($action['uses']);
        }

        return $action;
    }

    /**
     * Get an action for a route that has no action.
     *
     * @param  string  $uri
     * @return array
     *
     * @throws \LogicException
     */
    protected static function missingAction($uri)
    {
        return ['uses' => function () use ($uri) {
            throw new LogicException("Route for [{$uri}] has no action.");
        }];
    }

    /**
     * Find the callable in an action array.
     *
     * @param  array  $action
     * @return callable
     */
    protected static function findCallable(array $action)
    {
        return Arr::first($action, function ($value, $key) {
            return Reflector::isCallable($value) && is_numeric($key);
        });
    }

    /**
     * Make an action for an invokable controller.
     *
     * @param  string  $action
     * @return string
     *
     * @throws \UnexpectedValueException
     */
    protected static function makeInvokable($action)
    {
        if (! method_exists($action, '__invoke')) {
            throw new UnexpectedValueException("Invalid route action: [{$action}].");
        }

        return $action.'@__invoke';
    }

    /**
     * Determine if the given array actions contain a serialized Closure.
     *
     * @param  array  $action
     * @return bool
     */
    public static function containsSerializedClosure(array $action)
    {
        return is_string($action['uses']) && Str::startsWith($action['uses'], [
            'O:47:"Laravel\\SerializableClosure\\SerializableClosure',
            'O:55:"Laravel\\SerializableClosure\\UnsignedSerializableClosure',
        ]) !== false;
    }
}

Directory Contents

Dirs: 7 × Files: 38

Name Size Perms Modified Actions
Console DIR
- drwxrwxrwx 2025-09-17 06:53:02
Edit Download
Contracts DIR
- drwxrwxrwx 2025-09-17 06:53:02
Edit Download
- drwxrwxrwx 2025-09-17 06:53:02
Edit Download
Events DIR
- drwxrwxrwx 2025-09-17 06:53:02
Edit Download
- drwxrwxrwx 2025-09-17 06:53:02
Edit Download
Matching DIR
- drwxrwxrwx 2025-09-17 06:53:02
Edit Download
- drwxrwxrwx 2025-09-17 06:53:02
Edit Download
8.57 KB lrw-rw-rw- 2025-09-17 06:53:02
Edit Download
1.34 KB lrw-rw-rw- 2025-09-17 06:53:02
Edit Download
8.82 KB lrw-rw-rw- 2025-09-17 06:53:02
Edit Download
1.55 KB lrw-rw-rw- 2025-09-17 06:53:02
Edit Download
1.62 KB lrw-rw-rw- 2025-09-17 06:53:02
Edit Download
2.25 KB lrw-rw-rw- 2025-09-17 06:53:02
Edit Download
1009 B lrw-rw-rw- 2025-09-17 06:53:02
Edit Download
2.54 KB lrw-rw-rw- 2025-09-17 06:53:02
Edit Download
524 B lrw-rw-rw- 2025-09-17 06:53:02
Edit Download
4.46 KB lrw-rw-rw- 2025-09-17 06:53:02
Edit Download
1.05 KB lrw-rw-rw- 2025-09-17 06:53:02
Edit Download
3.10 KB lrw-rw-rw- 2025-09-17 06:53:02
Edit Download
7.56 KB lrw-rw-rw- 2025-09-17 06:53:02
Edit Download
6.83 KB lrw-rw-rw- 2025-09-17 06:53:02
Edit Download
1.49 KB lrw-rw-rw- 2025-09-17 06:53:02
Edit Download
1.22 KB lrw-rw-rw- 2025-09-17 06:53:02
Edit Download
7.22 KB lrw-rw-rw- 2025-09-17 06:53:02
Edit Download
3.81 KB lrw-rw-rw- 2025-09-17 06:53:02
Edit Download
21.73 KB lrw-rw-rw- 2025-09-17 06:53:02
Edit Download
8.53 KB lrw-rw-rw- 2025-09-17 06:53:02
Edit Download
32.38 KB lrw-rw-rw- 2025-09-17 06:53:02
Edit Download
3.38 KB lrw-rw-rw- 2025-09-17 06:53:02
Edit Download
3.02 KB lrw-rw-rw- 2025-09-17 06:53:02
Edit Download
6.93 KB lrw-rw-rw- 2025-09-17 06:53:02
Edit Download
2.28 KB lrw-rw-rw- 2025-09-17 06:53:02
Edit Download
135 B lrw-rw-rw- 2025-09-17 06:53:02
Edit Download
641 B lrw-rw-rw- 2025-09-17 06:53:02
Edit Download
2.67 KB lrw-rw-rw- 2025-09-17 06:53:02
Edit Download
3.04 KB lrw-rw-rw- 2025-09-17 06:53:02
Edit Download
39.78 KB lrw-rw-rw- 2025-09-17 06:53:02
Edit Download
8.61 KB lrw-rw-rw- 2025-09-17 06:53:02
Edit Download
1.60 KB lrw-rw-rw- 2025-09-17 06:53:02
Edit Download
1.29 KB lrw-rw-rw- 2025-09-17 06:53:02
Edit Download
9.05 KB lrw-rw-rw- 2025-09-17 06:53:02
Edit Download
6.65 KB lrw-rw-rw- 2025-09-17 06:53:02
Edit Download
3.75 KB lrw-rw-rw- 2025-09-17 06:53:02
Edit Download
23.47 KB lrw-rw-rw- 2025-09-17 06:53:02
Edit Download
1.41 KB lrw-rw-rw- 2025-09-17 06:53:02
Edit Download

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