Skip to content

Commit

Permalink
More documentation for the config file
Browse files Browse the repository at this point in the history
  • Loading branch information
markmercedes committed Jun 22, 2013
1 parent 50f0147 commit 6b0f27a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/trest_init.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@
* procedural file used to setup the TRest library
*
* @author Marcos Mercedes <marcos.mercedesn@gmail.com>
* @package TRest
*/
namespace TRest;

define('TREST_LIB_PATH', __DIR__);
define('TREST_LIB_THIRD_PARTY_PATH', TREST_LIB_PATH . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'ThirdParty');
/**
*
* @var integer the amount of time in seconds that will be used by default save
* cache for the responses
*/
define('TREST_DEFAULT_CACHE_TTL', 120);

use TRest\Config\TRestConfigFactory;
Expand All @@ -26,6 +32,10 @@
* Perfect Tree <http://pixelpt.com/>
*/

/**
* The config named 'default' will be used for the models without the property
* => protected static $configName = 'StackOverflow';
*/
TRestConfigFactory::add('default', new TRestConfig(array(
'apiUrl' => 'http://pixelpt-sandwich-api.herokuapp.com/',
'singleItemNode' => 'sandwich',
Expand All @@ -36,6 +46,10 @@
* Stack overflow public used to look for users data
*/

/**
* The model with this property value will use this configuration => protected
* static $configName = 'StackOverflow';
*/
TRestConfigFactory::add('StackOverflow', new TRestConfig(array(
'apiUrl' => 'http://api.stackoverflow.com/1.1/',
'cacheAdapter' => new TRestFastCache()
Expand Down

0 comments on commit 6b0f27a

Please sign in to comment.