Permalink
Browse files

Renamed docroot config variable to baseUri to better describe its pur…

…pose.
  • Loading branch information...
1 parent 6d3e29a commit 36b10f5583bc325b2b7f54a3cd8c0f90cdaddd75 @peej committed Jan 2, 2011
Showing with 9 additions and 9 deletions.
  1. +6 −6 lib/tonic.php
  2. +3 −3 tests/request.php
View
@@ -13,10 +13,10 @@ class Request {
var $uri;
/**
- * The subdir where is the docroot
+ * The URI where the front controller is positioned in the server URI-space
* @var str
*/
- var $docroot;
+ var $baseUri = '';
/**
* Array of possible URIs based upon accept and accept-language request headers in order of preference
@@ -164,7 +164,7 @@ function __construct($config = array()) {
// set defaults
$config['uri'] = $this->getConfig($config, 'uri', 'REQUEST_URI');
- $config['docroot'] = $this->getConfig($config, 'docroot', '');
+ $config['baseUri'] = $this->getConfig($config, 'baseUri', '');
$config['accept'] = $this->getConfig($config, 'accept', 'HTTP_ACCEPT');
$config['acceptLang'] = $this->getConfig($config, 'acceptLang', 'HTTP_ACCEPT_LANGUAGE');
$config['acceptEncoding'] = $this->getConfig($config, 'acceptEncoding', 'HTTP_ACCEPT_ENCODING');
@@ -177,8 +177,8 @@ function __construct($config = array()) {
}
}
- // set docroot
- $this->docroot = $config['docroot'];
+ // set baseUri
+ $this->baseUri = $config['baseUri'];
// get request URI
$parts = explode('/', $config['uri']);
@@ -402,7 +402,7 @@ function loadResource() {
$uriMatches = array();
foreach ($this->resources as $uri => $resource) {
- if (preg_match('|^'.$this->docroot.str_replace('|', '\|', $uri).'$|', $this->uri, $matches)) {
+ if (preg_match('|^'.$this->baseUri.str_replace('|', '\|', $uri).'$|', $this->uri, $matches)) {
array_shift($matches);
$uriMatches[$resource['priority']] = array(
$resource['class'],
View
@@ -19,15 +19,15 @@ function testRequestURI() {
}
- function testRequestDocroot() {
+ function testRequestBaseUri() {
$config = array(
- 'docroot' => '/some/sub/dir'
+ 'baseUri' => '/some/sub/dir'
);
$request = new Request($config);
- $this->assertEqual($request->docroot, $config['docroot']);
+ $this->assertEqual($request->baseUri, $config['baseUri']);
}

0 comments on commit 36b10f5

Please sign in to comment.