Source for file ServiceLocator.php
Documentation is available at ServiceLocator.php
- 1: <?php
- 3: /**
- 4: * Nette Framework
- 5: *
- 6: * Copyright (c) 2004, 2009 David Grudl (http://davidgrudl.com)
- 7: *
- 8: * This source file is subject to the "Nette license" that is bundled
- 9: * with this package in the file license.txt.
- 10: *
- 11: * For more information please see https://nette.org
- 12: *
- 19: */
- 29: /**
- 30: * Service locator pattern implementation.
- 31: *
- 35: */
- 37: {
- 49: /**
- 51: */
- 53: {
- 55: }
- 59: /**
- 60: * Adds the specified service to the service container.
- 66: */
- 68: {
- 77: throw new InvalidArgumentException('When factory callback is given, service name must be specified.');
- 78: }
- 82: }
- 87: }
- 94: }
- 98: }
- 99: }
- 103: /**
- 104: * Removes the specified service type from the service container.
- 107: */
- 109: {
- 112: }
- 119: }
- 120: }
- 124: /**
- 125: * Gets the service object of the specified type.
- 129: */
- 131: {
- 134: }
- 146: // trick to pass callback as string
- 153: throw new AmbiguousServiceException("Cannot instantiate service '$name', class '$service' not found.");
- 154: }
- 156: }
- 157: }
- 162: throw new AmbiguousServiceException("Cannot instantiate service '$name', handler '$textual' is not " . ($able ? 'callable.' : 'valid PHP callback.'));
- 163: }
- 166: }
- 176: }
- 177: }
- 181: /**
- 182: * Returns the parent container if any.
- 184: */
- 186: {
- 188: }
- 190: }
- 194: /**
- 195: * Ambiguous service resolution exception.
- 196: *
- 200: */
- 202: {
- 203: }
