Skip to content

Instantly share code, notes, and snippets.

@mikeschinkel
Created October 18, 2018 19:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikeschinkel/1557a07e6a75d06ac99f37315898920e to your computer and use it in GitHub Desktop.
Save mikeschinkel/1557a07e6a75d06ac99f37315898920e to your computer and use it in GitHub Desktop.
The Problems with Pimple - What's wrong with this picture?
<?php
$container = new Pimple();
$container['auth'] = function($c) {
return new OAuth();
};
$container['db'] = function($c) {
return new DB();
};
$container['tweet_service'] = function($c) {
$twService = new TwitterService();
$twService->setDB($c['db']);
$twService->setOauth($c['oauth']);
return $twService;
};
$container['soclal_feeds'] = function($c) {
$socialFeeds = new SocialFeeds();
$socialFeeds->setTwitterService($c['tweet_servlce']);
return $socialFeeds;
};
$socialFeeds = $container['social_feeds'];
$socialFeeds->getSocialFeeds();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment