AbstractDeleteService   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 16
loc 16
ccs 5
cts 5
cp 1
rs 10
c 0
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
use DavisPeixoto\BlogCore\Interfaces\ServiceInterface;
12
use Exception;
13
14
/**
15
 * Class AbstractDeleteService
16
 * @package DavisPeixoto\BlogCore\Service
17
 */
18 View Code Duplication
abstract class AbstractDeleteService extends AbstractWriteService implements ServiceInterface
19
{
20
    /**
21
     * @return boolean
22
     */
23 12
    public function run(): bool
24
    {
25
        try {
26 12
            return $this->repository->delete($this->entity);
27 4
        } catch (Exception $e) {
28 4
            $this->logger->error($e->getMessage());
29
        }
30
31 4
        return false;
32
    }
33
}
34