GildedRose-Refactoring-Kata/php/config/ioc.php
naciriii 66867fbe7a refactor: set global architecture and refactor code
- Create an Ioc container and set factories and services
- Adjust degrading Strategies
- Clean up and do global chores here and there and avoid Dry code
- Write unit and integration tests and ensure correct business logic
2022-03-30 05:34:47 +01:00

25 lines
549 B
PHP

<?php
declare(strict_types=1);
use GildedRose\Services\AbstractDegradingStrategyFactory;
use GildedRose\Services\DegradingStrategyFactory;
/**
* Here We set Bindings between Interfaces and abstraction to implementation
*/
const BINDINGS =
[
AbstractDegradingStrategyFactory::class => DegradingStrategyFactory::class
];
// Helper Method to get implementation
function resolve(string $interface)
{
try {
return BINDINGS[$interface];
} catch (Throwable $e) {
throw new Exception('Cannot Find Implementation');
}
}