Completed
Push — master ( 676347...810a64 )
by Artem
02:44
created

WritesLogs   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 26
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A log() 0 7 1
1
<?php
2
3
namespace Slides\Connector\Auth\Concerns;
4
5
use Illuminate\Support\Facades\Log;
6
7
/**
8
 * Trait WritesLogs
9
 *
10
 * @package Slides\Connector\Auth\Concerns
11
 */
12
trait WritesLogs
13
{
14
    /**
15
     * The list of parameters that must be hidden.
16
     *
17
     * @var array
18
     */
19
    protected $excludeLoggingParameters = [
20
        'password'
21
    ];
22
23
    /**
24
     * Send a message to logger.
25
     *
26
     * @param string|null $message
27
     * @param array $context
28
     *
29
     * @return void
30
     */
31
    protected function log(?string $message, array $context = [])
32
    {
33
        $securedContext = \Slides\Connector\Auth\Helpers\ArrayHelper::replaceValuesByMatchingKeys(
34
            $context, $this->excludeLoggingParameters, '...'
35
        );
36
37
        Log::debug('[Connector] ' . $message, $securedContext);
38
    }
39
}