Completed
Pull Request — master (#9)
by Davis
02:21
created

AbstractSaveService   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 16
loc 16
ccs 5
cts 5
cp 1
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 10 10 2

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
 * Created by PhpStorm.
4
 * User: davis
5
 * Date: 7/30/17
6
 * Time: 7:21 PM
7
 */
8
9
namespace DavisPeixoto\BlogCore\Service;
10
11
12
use DavisPeixoto\BlogCore\Interfaces\ServiceInterface;
13
use Exception;
14
15
/**
16
 * Class AbstractSaveService
17
 * @package DavisPeixoto\BlogCore\Service
18
 */
19 View Code Duplication
abstract class AbstractSaveService extends AbstractWriteService implements ServiceInterface
1 ignored issue
show
Duplication introduced by
This class 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...
20
{
21
    /**
22
     * @return string|null
23
     */
24 16
    public function run()
25
    {
26
        try {
27 16
            return $this->repository->save($this->entity);
28 8
        } catch (Exception $e) {
29 8
            $this->logger->error($e->getMessage());
30
        }
31
32 8
        return null;
33
    }
34
}
35