File "MatchedRoute.php"

Full Path: /var/www/html/back/vendor/knuckleswtf/scribe/src/Matching/MatchedRoute.php
File size: 1.01 KB
MIME-type: text/x-php
Charset: utf-8

<?php

namespace Knuckles\Scribe\Matching;

use Illuminate\Routing\Route;

class MatchedRoute implements \ArrayAccess
{
    protected Route $route;

    /** @deprecated Use the strategy config instead */
    protected array $rules;

    public function __construct(Route $route, array $applyRules = [])
    {
        $this->route = $route;
        $this->rules = $applyRules;
    }

    public function getRoute(): Route
    {
        return $this->route;
    }

    /** @deprecated Use the strategy config instead */
    public function getRules(): array
    {
        return $this->rules;
    }

    public function offsetExists($offset): bool
    {
        return is_callable([$this, 'get' . ucfirst($offset)]);
    }

    public function offsetGet($offset): mixed
    {
        return call_user_func([$this, 'get' . ucfirst($offset)]);
    }

    public function offsetSet($offset, $value): void
    {
        $this->$offset = $value;
    }

    public function offsetUnset($offset): void
    {
        $this->$offset = null;
    }
}