Issues (24)

src/Manager/HasChannels.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Nip\Logger\Manager;
4
5
/**
6
 * Trait HasChannels
7
 * @package Nip\Logger\Traits
8
 */
9
trait HasChannels
10
{
11
    /**
12
     * The array of resolved channels.
13
     *
14
     * @var array
15
     */
16
    protected $channels = [];
17
18
    /**
19
     * Get a log channel instance.
20
     *
21
     * @param string|null $channel
22
     * @return \Psr\Log\LoggerInterface
23
     */
24 1
    public function channel($channel = null)
25
    {
26 1
        return $this->driver($channel);
0 ignored issues
show
It seems like driver() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

26
        return $this->/** @scrutinizer ignore-call */ driver($channel);
Loading history...
27
    }
28
29
    /**
30
     * Extract the log channel from the given configuration.
31
     *
32
     * @param array $config
33
     * @return string
34
     */
35 4
    protected function parseChannel(array $config)
36
    {
37 4
        return $config['name'] ?? $this->getFallbackChannelName();
38
    }
39
40
    /**
41
     * Get fallback log channel name.
42
     *
43
     * @return string
44
     */
45 4
    protected function getFallbackChannelName()
46
    {
47 4
        return 'production';
48
//        return $this->app->bound('env') ? $this->app->environment() : 'production';
49
    }
50
}
51