mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-21 04:50:55 +01:00
23786784ef
Summary: Adds the Balanced PHP API to externals/. Ref T2787. Test Plan: Used in next diff. Reviewers: btrahan, chad Reviewed By: chad CC: aran, aurelijus Maniphest Tasks: T2787 Differential Revision: https://secure.phabricator.com/D5764
29 lines
542 B
PHP
29 lines
542 B
PHP
<?php
|
|
|
|
namespace RESTful;
|
|
|
|
class Registry
|
|
{
|
|
protected $_resources = array();
|
|
|
|
public function add($resource)
|
|
{
|
|
array_push($this->_resources, $resource);
|
|
}
|
|
|
|
public function match($uri)
|
|
{
|
|
foreach ($this->_resources as $resource) {
|
|
$spec = $resource::getURISpec();
|
|
$result = $spec->match($uri);
|
|
if ($result == null) {
|
|
continue;
|
|
}
|
|
$result['class'] = $resource;
|
|
|
|
return $result;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|