Passed
Pull Request — master (#182)
by Arman
03:14
created

LoggerFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
dl 0
loc 13
rs 10
c 1
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A createLogger() 0 7 2
1
<?php
2
/**
3
 * Quantum PHP Framework
4
 *
5
 * An open source software development framework for PHP
6
 *
7
 * @package Quantum
8
 * @author Arman Ag. <[email protected]>
9
 * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org)
10
 * @link http://quantum.softberg.org/
11
 * @since 2.9.5
12
 */
13
14
namespace Quantum\Logger;
15
16
use Quantum\Logger\Adapters\MessageAdapter;
17
18
/**
19
 * Class LoggerFactory
20
 * @package Quantum\Logger
21
 */
22
class LoggerFactory
23
{
24
    /**
25
     * @param ReportableInterface|null $loggerAdapter
26
     * @return Logger
27
     */
28
    public static function createLogger(?ReportableInterface $loggerAdapter = null): Logger
29
    {
30
        if ($loggerAdapter === null) {
31
            $loggerAdapter = new MessageAdapter();
32
        }
33
34
        return new Logger($loggerAdapter);
35
    }
36
}