Test Failed
Push — master ( d53e87...2aa0fd )
by Julien
04:55
created

ServiceProvider   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
eloc 13
dl 0
loc 31
ccs 0
cts 12
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 16 1
1
<?php
2
/**
3
 * This file is part of the Zemit Framework.
4
 *
5
 * (c) Zemit Team <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE.txt
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Zemit\Provider\Imap;
12
13
use Phalcon\Di\DiInterface;
14
use Zemit\Bootstrap\Config;
15
use Zemit\Provider\AbstractServiceProvider;
16
17
/**
18
 * Zemit\Provider\Imap\ServiceProvider
19
 *
20
 * @package Zemit\Provider\Imap
21
 */
22
class ServiceProvider extends AbstractServiceProvider
23
{
24
    /**
25
     * The Service name.
26
     * @var string
27
     */
28
    protected $serviceName = 'imap';
29
30
    /**
31
     * {@inheritdoc}
32
     *
33
     * Register the Flash Service with the Twitter Bootstrap classes.
34
     *
35
     * @return void
36
     */
37
    public function register(DiInterface $di): void
38
    {
39
        $di->setShared($this->getName(), function() use ($di) {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
40
            /** @var Config $config */
41
            $config = $di->get('config');
42
43
            $defaults = $config->path('imap')->toArray();
44
45
            return new \PhpImap\Mailbox(
46
                $defaults['path'] ?? '',
47
                $defaults['login'] ?? '',
48
                $defaults['password'] ?? '',
49
                $defaults['attachmentsDir'] ?? '',
50
                $defaults['serverEncoding'] ?? 'UTF-8',
51
                $defaults['trimImapPath'] ?? true,
52
                $defaults['attachmentFilenameMode'] ?? false,
53
            );
54
        });
55
    }
56
}
57