29 lines
444 B
PHP
29 lines
444 B
PHP
<?php
|
|
|
|
interface mtgScope
|
|
{
|
|
function findSymbol(string $name) : ?mtgMetaUnit;
|
|
}
|
|
|
|
class mtgMultiScope implements mtgScope
|
|
{
|
|
private array $scopes = array();
|
|
|
|
function addScope(mtgScope $scope)
|
|
{
|
|
$this->scopes[] = $scope;
|
|
}
|
|
|
|
function findSymbol(string $name) : ?mtgMetaUnit
|
|
{
|
|
foreach($this->scopes as $scope)
|
|
{
|
|
$unit = $scope->findSymbol($name);
|
|
if($unit)
|
|
return $unit;
|
|
}
|
|
return null;
|
|
}
|
|
}
|
|
|