GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 7a17c4...cc7816 )
by Pavel
08:09
created

MailingExtension::expandConfigParams()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 16
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 9
nc 1
nop 0
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
Deprecated Code introduced by
The method Nette\DI\ServiceDefinition::setClass() has been deprecated.

This method has been deprecated.

Loading history...
43
			->setClass(MailLogger::class)
44
			->setArguments([$config['logDirectory']]);
45
46
		$builder->addDefinition($this->prefix('mailFactory'))
0 ignored issues
show
Deprecated Code introduced by
The method Nette\DI\ServiceDefinition::setClass() has been deprecated.

This method has been deprecated.

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);
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