. * */ function_exists('tubepress_load_classes') || require(dirname(__FILE__) . '/../../../tubepress_classloader.php'); tubepress_load_classes(array('net_sourceforge_phpcrafty_ComponentFactory')); /** * Dependency injector for TubePress that uses phpcrafty */ abstract class org_tubepress_ioc_PhpCraftyIocService extends net_sourceforge_phpcrafty_ComponentFactory { public function get($className) { return $this->create($className); } public function ref($referenceName) { return $this->referenceFor($referenceName); } public function def($referenceName, $spec) { $this->setComponentSpec($referenceName, $spec); } /** * Define an implementation for a class. We'll never use constructor * injection, and we'll only use singletons, so this is just a convenience class. * * @param $className * @param $properties * @return unknown_type */ public function impl($className, $properties = array()) { return $this->newComponentSpec($className, array(), $properties, true); } public function safeGet($firstChoice, $safeChoice) { if ($this->getComponentSpec($firstChoice) != null) { return $this->get($firstChoice); } return $this->get($safeChoice); } }