123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <?php
- namespace Knuckles\Scribe\Matching;
- use Illuminate\Routing\Route;
- class MatchedRoute implements \ArrayAccess
- {
- /**
- * @var Route
- */
- protected $route;
- /**
- * @var array
- */
- protected $rules;
- /**
- * Match constructor.
- *
- * @param Route $route
- * @param array $applyRules
- */
- public function __construct(Route $route, array $applyRules)
- {
- $this->route = $route;
- $this->rules = $applyRules;
- }
- /**
- * @return Route
- */
- public function getRoute()
- {
- return $this->route;
- }
- /**
- * @return array
- */
- public function getRules()
- {
- return $this->rules;
- }
- /**
- * {@inheritdoc}
- */
- public function offsetExists($offset)
- {
- return is_callable([$this, 'get' . ucfirst($offset)]);
- }
- /**
- * {@inheritdoc}
- */
- public function offsetGet($offset)
- {
- return call_user_func([$this, 'get' . ucfirst($offset)]);
- }
- /**
- * {@inheritdoc}
- */
- public function offsetSet($offset, $value)
- {
- $this->$offset = $value;
- }
- /**
- * {@inheritdoc}
- */
- public function offsetUnset($offset)
- {
- $this->$offset = null;
- }
- }
|