These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | /** |
||
6 | * @copyright Copyright (c) 2015 ublaboo <[email protected]> |
||
7 | * @author Pavel Janda <[email protected]> |
||
8 | * @package Ublaboo |
||
9 | */ |
||
10 | |||
11 | namespace Ublaboo\Mailing\DI; |
||
12 | |||
13 | use Nette\DI\CompilerExtension; |
||
14 | use Nette\DI\Helpers; |
||
15 | use Ublaboo\Mailing\MailFactory; |
||
16 | use Ublaboo\Mailing\MailLogger; |
||
17 | |||
18 | class MailingExtension extends CompilerExtension |
||
19 | { |
||
20 | |||
21 | public const CONFIG_LOG = 'log'; |
||
22 | public const CONFIG_SEND = 'send'; |
||
23 | public const CONFIG_BOTH = 'both'; |
||
24 | |||
25 | /** |
||
26 | * @var array |
||
27 | */ |
||
28 | private $defaults = [ |
||
29 | 'do' => self::CONFIG_BOTH, |
||
30 | 'logDirectory' => '%appDir%/../log/mails', |
||
31 | 'mailImagesBasePath' => '%wwwDir%', |
||
32 | 'mails' => [], |
||
33 | ]; |
||
34 | |||
35 | |||
36 | public function loadConfiguration(): void |
||
37 | { |
||
38 | $config = $this->expandConfigParams(); |
||
39 | |||
40 | $builder = $this->getContainerBuilder(); |
||
41 | |||
42 | $builder->addDefinition($this->prefix('mailLogger')) |
||
0 ignored issues
–
show
|
|||
43 | ->setClass(MailLogger::class) |
||
44 | ->setArguments([$config['logDirectory']]); |
||
45 | |||
46 | $builder->addDefinition($this->prefix('mailFactory')) |
||
0 ignored issues
–
show
The method
Nette\DI\Definitions\ServiceDefinition::setClass() has been deprecated with message: Use setType()
This method has been deprecated. The supplier of the class has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.
Loading history...
|
|||
47 | ->setClass(MailFactory::class) |
||
48 | ->setArguments([$config['do'], $config['mailImagesBasePath'], $config['mails']]); |
||
49 | } |
||
50 | |||
51 | |||
52 | private function expandConfigParams(): array |
||
53 | { |
||
54 | $config = $this->validateConfig($this->defaults, $this->config); |
||
0 ignored issues
–
show
The method
Nette\DI\CompilerExtension::validateConfig() has been deprecated with message: use getConfigSchema()
This method has been deprecated. The supplier of the class has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.
Loading history...
|
|||
55 | |||
56 | $config['logDirectory'] = Helpers::expand( |
||
57 | $config['logDirectory'], |
||
58 | $this->getContainerBuilder()->parameters |
||
59 | ); |
||
60 | |||
61 | $config['mailImagesBasePath'] = Helpers::expand( |
||
62 | $config['mailImagesBasePath'], |
||
63 | $this->getContainerBuilder()->parameters |
||
64 | ); |
||
65 | |||
66 | return $config; |
||
67 | } |
||
68 | } |
||
69 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.