Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- someFactory(InstanceManager $im, $service)
- {
- // calculate the service
- // ...
- // and do this:
- $im->set($service, $result);
- // or:
- $this->service = $result;
- // and on subsequent calls, return it early:
- if ($this->service) {
- return $this->service;
- }
- }
Add Comment
Please, Sign In to add comment