friendica/src/Factory/DependencyFactory.php
Philipp Holzer 55999730e0
Introduce DICE
- Adding dice library
- Adding dependency config

- Removing Factories
- Refactoring App\Mode constructor
- Refactoring App\Router constructor
- Refactoring BasePath for DI usage
- Refactoring ConfigFileLoader constructor
- Refactoring Profiler constructor

- Adjust entrypoints (index, console, worker, ..)

- Adding functional test for DI
- Fix tests because of refactorings
2019-07-21 01:22:10 +02:00

31 lines
762 B
PHP

<?php
namespace Friendica\Factory;
use Dice\Dice;
use Friendica\App;
use Friendica\Core\Config\PConfiguration;
use Psr\Log\LoggerInterface;
class DependencyFactory
{
/**
* Setting all default-dependencies of a friendica execution
*
* @param string $channel The channel of this execution
* @param bool $isBackend True, if it's a backend execution, otherwise false (Default true)
*
* @return App The application
*
* @throws \Exception
*/
public static function setUp($channel, Dice $dice, $isBackend = true)
{
$pConfig = $dice->create(PConfiguration::class);
$logger = $dice->create(LoggerInterface::class, [$channel]);
$devLogger = $dice->create('$devLogger', [$channel]);
return $dice->create(App::class, [$isBackend]);
}
}