mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-12-02 13:09:53 +09:00
Dependency updates and update version number
This commit is contained in:
@@ -23,13 +23,15 @@ class CollectionConfigurator
|
||||
use Traits\RouteTrait;
|
||||
|
||||
private $parent;
|
||||
private $parentConfigurator;
|
||||
|
||||
public function __construct(RouteCollection $parent, $name)
|
||||
public function __construct(RouteCollection $parent, $name, self $parentConfigurator = null)
|
||||
{
|
||||
$this->parent = $parent;
|
||||
$this->name = $name;
|
||||
$this->collection = new RouteCollection();
|
||||
$this->route = new Route('');
|
||||
$this->parentConfigurator = $parentConfigurator; // for GC control
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
@@ -50,7 +52,7 @@ class CollectionConfigurator
|
||||
{
|
||||
$this->collection->add($this->name.$name, $route = clone $this->route);
|
||||
|
||||
return new RouteConfigurator($this->collection, $route->setPath($path), $this->name);
|
||||
return new RouteConfigurator($this->collection, $route->setPath($path), $this->name, $this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,7 +62,7 @@ class CollectionConfigurator
|
||||
*/
|
||||
final public function collection($name = '')
|
||||
{
|
||||
return new self($this->collection, $this->name.$name);
|
||||
return new self($this->collection, $this->name.$name, $this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,10 +22,13 @@ class RouteConfigurator
|
||||
use Traits\AddTrait;
|
||||
use Traits\RouteTrait;
|
||||
|
||||
public function __construct(RouteCollection $collection, Route $route, $name = '')
|
||||
private $parentConfigurator;
|
||||
|
||||
public function __construct(RouteCollection $collection, Route $route, $name = '', CollectionConfigurator $parentConfigurator = null)
|
||||
{
|
||||
$this->collection = $collection;
|
||||
$this->route = $route;
|
||||
$this->name = $name;
|
||||
$this->parentConfigurator = $parentConfigurator; // for GC control
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,9 +39,17 @@ class RoutingConfigurator
|
||||
final public function import($resource, $type = null, $ignoreErrors = false)
|
||||
{
|
||||
$this->loader->setCurrentDir(dirname($this->path));
|
||||
$subCollection = $this->loader->import($resource, $type, $ignoreErrors, $this->file);
|
||||
$imported = $this->loader->import($resource, $type, $ignoreErrors, $this->file);
|
||||
if (!is_array($imported)) {
|
||||
return new ImportConfigurator($this->collection, $imported);
|
||||
}
|
||||
|
||||
return new ImportConfigurator($this->collection, $subCollection);
|
||||
$mergedCollection = new RouteCollection();
|
||||
foreach ($imported as $subCollection) {
|
||||
$mergedCollection->addCollection($subCollection);
|
||||
}
|
||||
|
||||
return new ImportConfigurator($this->collection, $mergedCollection);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -34,9 +34,10 @@ trait AddTrait
|
||||
*/
|
||||
final public function add($name, $path)
|
||||
{
|
||||
$parentConfigurator = $this instanceof RouteConfigurator ? $this->parentConfigurator : null;
|
||||
$this->collection->add($this->name.$name, $route = new Route($path));
|
||||
|
||||
return new RouteConfigurator($this->collection, $route);
|
||||
return new RouteConfigurator($this->collection, $route, '', $parentConfigurator);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user