Completed
Pull Request — master (#36)
by
unknown
02:53
created

SyncCommand   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 37
Duplicated Lines 24.32 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 3
dl 9
loc 37
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getOutputRedirection() 0 3 1
A getShouldUnlockOnCompletion() 0 3 1
A getSendMailOnError() 0 3 1
A getLogger() 9 9 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace App\Satis\Context;
4
5
use App\Satis\CommandContextInterface;
6
use Monolog\Formatter\LineFormatter;
7
use Monolog\Handler\StreamHandler;
8
use Monolog\Logger;
9
10
/**
11
 * @author Lukas Homza <[email protected]>
12
 */
13
class SyncCommand implements CommandContextInterface {
14
    /**
15
     * @param string $logFile
16
     * @return string
17
     */
18
    public function getOutputRedirection($logFile) {
19
        return '';
20
    }
21
22
    /**
23
     * @return string
24
     */
25
    public function getShouldUnlockOnCompletion() {
26
        return '';
27
    }
28
29
    /**
30
     * @param string $email
31
     * @param string $message
32
     * @return string
33
     */
34
    public function getSendMailOnError($email, $message) {
35
        return '';
36
    }
37
    /**
38
     * @return \Monolog\Logger
39
     */
40 View Code Duplication
    public function getLogger() {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
41
        $handler = new StreamHandler(storage_path('logs/builder_sync.log'), Logger::DEBUG);
42
        $handler->setFormatter(new LineFormatter(null, null, true, true));
43
44
        $logger = new Logger('SyncBuildLog');
45
        $logger->pushHandler($handler);
46
47
        return $logger;
48
    }
49
}
50