| 1 | <?php |
||
| 17 | class StorageStack |
||
| 18 | { |
||
| 19 | /** |
||
| 20 | * @var StorageInterface Scope collection |
||
| 21 | */ |
||
| 22 | protected $scopes; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @param array $scopes Initial scopes |
||
| 26 | */ |
||
| 27 | 20 | public function __construct($scopes = array()) |
|
| 35 | |||
| 36 | /** |
||
| 37 | * Sets scope. |
||
| 38 | * |
||
| 39 | * @param string $scope Scope name |
||
| 40 | * @param StorageInterface $storage Scoped storage |
||
| 41 | */ |
||
| 42 | 8 | public function setScope($scope, StorageInterface $storage) |
|
| 46 | |||
| 47 | /** |
||
| 48 | * Gets scope. |
||
| 49 | * |
||
| 50 | * @param string $scope Scope name |
||
| 51 | * |
||
| 52 | * @throws ObjectNotFoundException |
||
| 53 | * |
||
| 54 | * @return StorageInterface Object |
||
| 55 | */ |
||
| 56 | 8 | public function getScope($scope) |
|
| 60 | |||
| 61 | /** |
||
| 62 | * Removes scope. |
||
| 63 | * |
||
| 64 | * @param string $scope Scope name |
||
| 65 | */ |
||
| 66 | 1 | public function removeScope($scope) |
|
| 70 | |||
| 71 | /** |
||
| 72 | * Returns all scopes. |
||
| 73 | * |
||
| 74 | * @return array|\Iterator|\Traversable Scope collection |
||
| 75 | */ |
||
| 76 | 3 | public function getScopes() |
|
| 80 | } |
||
| 81 |