/** * @test * @since 6.0.0 */ public function usesImplementationSpecifiedForMode() { $binder = new Binder(); assert($binder->setEnvironment('DEV')->getInjector()->getInstance(Person3::class), isInstanceOf(Mikey::class)); }
/** * configure the binder * * @param \stubbles\ioc\Binder $binder * @param string $projectPath optional project base path */ public function configure(Binder $binder, string $projectPath = null) { $this->environment->registerErrorHandler($projectPath); $this->environment->registerExceptionHandler($projectPath); $binder->setEnvironment($this->environment->name())->bind(Environment::class)->toInstance($this->environment); if (file_exists($this->propertiesFile($projectPath))) { $binder->bindPropertiesFromFile($this->propertiesFile($projectPath), $this->environment->name()); } $binder->bindConstant('stubbles.project.path')->to($projectPath); foreach ($this->buildPathes($projectPath) as $name => $value) { $binder->bindConstant($name)->to($value); } }