|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare( strict_types = 1 ); |
|
4
|
|
|
|
|
5
|
|
|
namespace WMDE\Fundraising\Frontend\Factories\EnvironmentSetup; |
|
6
|
|
|
|
|
7
|
|
|
use Doctrine\ORM\Tools\Setup; |
|
8
|
|
|
use Monolog\Handler\ErrorLogHandler; |
|
9
|
|
|
use Monolog\Logger; |
|
10
|
|
|
use WMDE\Fundraising\Frontend\Factories\FunFunFactory; |
|
11
|
|
|
use WMDE\Fundraising\Frontend\Presentation\Presenters\DevelopmentInternalErrorHtmlPresenter; |
|
12
|
|
|
|
|
13
|
|
|
class DevelopmentEnvironmentSetup implements EnvironmentSetup { |
|
14
|
|
|
|
|
15
|
|
|
private ErrorLogHandler $logHandler; |
|
16
|
1 |
|
|
|
17
|
1 |
|
public function setEnvironmentDependentInstances( FunFunFactory $factory ) { |
|
18
|
1 |
|
$this->logHandler = new ErrorLogHandler(); |
|
19
|
1 |
|
$this->setPaypalLogger( $factory ); |
|
20
|
1 |
|
$this->setSofortLogger( $factory ); |
|
21
|
1 |
|
$this->setDoctrineConfiguration( $factory ); |
|
22
|
|
|
$this->setErrorPageHtmlPresenter( $factory ); |
|
23
|
1 |
|
} |
|
24
|
1 |
|
|
|
25
|
1 |
|
private function setErrorPageHtmlPresenter( FunFunFactory $factory ) { |
|
26
|
1 |
|
$factory->setInternalErrorHtmlPresenter( |
|
27
|
|
|
new DevelopmentInternalErrorHtmlPresenter() |
|
28
|
1 |
|
); |
|
29
|
|
|
} |
|
30
|
1 |
|
|
|
31
|
1 |
|
private function setPaypalLogger( FunFunFactory $factory ) { |
|
32
|
1 |
|
$logger = new Logger( 'paypal', [ $this->logHandler ] ); |
|
33
|
1 |
|
$factory->setPaypalLogger( $logger ); |
|
34
|
|
|
} |
|
35
|
1 |
|
|
|
36
|
1 |
|
private function setSofortLogger( FunFunFactory $factory ) { |
|
37
|
1 |
|
$logger = new Logger( 'sofort', [ $this->logHandler ] ); |
|
38
|
1 |
|
$factory->setSofortLogger( $logger ); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
private function setDoctrineConfiguration( FunFunFactory $factory ) { |
|
42
|
|
|
// Setup will use /tmp for proxies and ArrayCache for caching |
|
43
|
|
|
$factory->setDoctrineConfiguration( Setup::createConfiguration( true ) ); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
} |
|
47
|
|
|
|