Passed
Pull Request — master (#405)
by Anton
07:13 queued 01:45
created

LogDependencyProvider   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 22
c 0
b 0
f 0
dl 0
loc 52
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getProcessors() 0 9 1
A getLogHandlers() 0 5 1
A getYvesSecurityAuditLogHandlerPlugins() 0 4 1
A getYvesSecurityAuditLogProcessorPlugins() 0 11 1
1
<?php
2
3
/**
4
 * This file is part of the Spryker Commerce OS.
5
 * For full license information, please view the LICENSE file that was distributed with this source code.
6
 */
7
8
namespace Pyz\Yves\Log;
9
10
use Spryker\Yves\Customer\Plugin\Log\CurrentCustomerDataRequestProcessorPlugin;
11
use Spryker\Yves\Log\LogDependencyProvider as SprykerLogDependencyProvider;
12
use Spryker\Yves\Log\Plugin\Handler\ExceptionStreamHandlerPlugin;
13
use Spryker\Yves\Log\Plugin\Handler\StreamHandlerPlugin;
14
use Spryker\Yves\Log\Plugin\Log\AuditLogMetaDataProcessorPlugin;
15
use Spryker\Yves\Log\Plugin\Log\AuditLogRequestProcessorPlugin;
16
use Spryker\Yves\Log\Plugin\Log\AuditLogTagFilterBufferedStreamHandlerPlugin;
17
use Spryker\Yves\Log\Plugin\Processor\EnvironmentProcessorPlugin;
18
use Spryker\Yves\Log\Plugin\Processor\GuzzleBodyProcessorPlugin;
19
use Spryker\Yves\Log\Plugin\Processor\PsrLogMessageProcessorPlugin;
20
use Spryker\Yves\Log\Plugin\Processor\RequestProcessorPlugin;
21
use Spryker\Yves\Log\Plugin\Processor\ResponseProcessorPlugin;
22
use Spryker\Yves\Log\Plugin\Processor\ServerProcessorPlugin;
23
use SprykerShop\Yves\AgentPage\Plugin\Log\AgentCurrentRequestProcessorPlugin;
24
25
class LogDependencyProvider extends SprykerLogDependencyProvider
26
{
27
    /**
28
     * @return array<\Monolog\Handler\HandlerInterface>
29
     */
30
    protected function getLogHandlers(): array
31
    {
32
        return [
33
            new StreamHandlerPlugin(),
34
            new ExceptionStreamHandlerPlugin(),
35
        ];
36
    }
37
38
    /**
39
     * @return list<\Spryker\Shared\Log\Dependency\Plugin\LogHandlerPluginInterface>
40
     */
41
    protected function getYvesSecurityAuditLogHandlerPlugins(): array
42
    {
43
        return [
0 ignored issues
show
Bug Best Practice introduced by
The expression return array(new Spryker...dStreamHandlerPlugin()) returns the type array<integer,Spryker\Yv...redStreamHandlerPlugin> which is incompatible with the documented return type Pyz\Yves\Log\list.
Loading history...
44
            new AuditLogTagFilterBufferedStreamHandlerPlugin(),
45
        ];
46
    }
47
48
    /**
49
     * @return array<\Spryker\Shared\Log\Dependency\Plugin\LogProcessorPluginInterface>
50
     */
51
    protected function getProcessors(): array
52
    {
53
        return [
54
            new PsrLogMessageProcessorPlugin(),
55
            new EnvironmentProcessorPlugin(),
56
            new ServerProcessorPlugin(),
57
            new RequestProcessorPlugin(),
58
            new ResponseProcessorPlugin(),
59
            new GuzzleBodyProcessorPlugin(),
60
        ];
61
    }
62
63
    /**
64
     * @return list<\Spryker\Shared\Log\Dependency\Plugin\LogProcessorPluginInterface>
65
     */
66
    protected function getYvesSecurityAuditLogProcessorPlugins(): array
67
    {
68
        return [
69
            new PsrLogMessageProcessorPlugin(),
70
            new EnvironmentProcessorPlugin(),
71
            new ServerProcessorPlugin(),
72
            new AuditLogRequestProcessorPlugin(),
73
            new CurrentCustomerDataRequestProcessorPlugin(),
74
            new ResponseProcessorPlugin(),
75
            new AuditLogMetaDataProcessorPlugin(),
76
            new AgentCurrentRequestProcessorPlugin(),
77
        ];
78
    }
79
}
80