Last active
December 10, 2015 20:58
-
-
Save dragoonis/4491612 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function getServiceConfig() | |
{ | |
return array('factories' => array( | |
// Create a service named foursquare.handler and map it to this lazy-loaded closure | |
// this is called from the controller. The code in this function is not called until a | |
// getService() call from a controller happens or if another service invokes it. | |
'foursquare.handler' => function($sm) { | |
// Construct the Api Handler and cache objects | |
$handler = new \FoursquareModule\Classes\ApiHandler(); | |
$cache = new \Doctrine\Common\Cache\ApcCache(); | |
// Pull the config data from the service manager ($sm) | |
$config = $sm->get('config'); | |
// Call the setters on the ApiHandler, passing in its dependencies | |
$handler->setSecret($config['foursquare']['secret']); | |
$handler->setKey($config['foursquare']['key']); | |
$handler->setCache($cache); | |
return $handler; | |
} | |
)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment