Файл: MobileCMS-2.7.0-beta/System/Kernel/Routing/RouteCollection.php
Строк: 55
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
namespace SystemKernelRouting;
/**
* Description of RouteCollection
*
* @author KpuTuK
*/
class RouteCollection extends ArrayObject {
public function __construct(array $collection = []) {
parent::__construct($collection);
}
public function getCollection() {
return $this->getArrayCopy();
}
public function addRoute($name, $pattern, $handler, array $methods = []) {
$this[$name] = new Route($name, $pattern, $handler, $methods);
}
public function offsetSet($index, $newval) {
if ( ! $newval instanceof Route) {
throw new InvalidArgumentException(sprintf(
'Роут "%s" должен реализовывать SystemKernelRoutingRoute'
), $index);
}
parent::offsetSet($index, $newval);
}
}