Cancelled
Branch master (8cb5b2)
by Christopher
04:16
created

MappingLogRepository   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 45
ccs 15
cts 15
cp 1
rs 10
c 0
b 0
f 0
wmc 6

5 Methods

Rating   Name   Duplication   Size   Complexity  
A find() 0 3 1
A delete() 0 4 2
A reset() 0 3 1
A all() 0 3 1
A add() 0 6 1
1
<?php
0 ignored issues
show
Coding Style introduced by
This file is missing a doc comment.
Loading history...
Coding Style introduced by
The PHP open tag does not have a corresponding PHP close tag
Loading history...
2
namespace Triadev\Leopard\Business\Repository;
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
4
use Illuminate\Support\Facades\DB;
5
use Triadev\Leopard\Contract\Repository\MappingLogRepositoryContract;
6
use Triadev\Leopard\Model\Entity\MappingLog;
7
8
class MappingLogRepository implements MappingLogRepositoryContract
0 ignored issues
show
Coding Style Documentation introduced by
Missing class doc comment
Loading history...
9
{
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration for class MappingLogRepository
Loading history...
10
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
Coding Style introduced by
Parameter $mapping should have a doc-comment as per coding-style.
Loading history...
11
     * @inheritdoc
12
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
13 12
    public function add(string $mapping)
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines before function; 0 found
Loading history...
14
    {
15 12
        $entity = new MappingLog();
16
        
17 12
        $entity->mapping = $mapping;
18 12
        $entity->saveOrFail();
19 12
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end add()
Loading history...
20
    
21
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
Coding Style introduced by
Parameter $id should have a doc-comment as per coding-style.
Loading history...
22
     * @inheritdoc
23
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
24 3
    public function find(int $id) : ?MappingLog
25
    {
26 3
        return MappingLog::find($id);
27
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end find()
Loading history...
28
    
29
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
Coding Style introduced by
Parameter $id should have a doc-comment as per coding-style.
Loading history...
30
     * @inheritdoc
31
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
32 3
    public function delete(int $id)
33
    {
34 3
        if ($mappingLog = $this->find($id)) {
0 ignored issues
show
Coding Style introduced by
Assignments must be the first block of code on a line
Loading history...
35 1
            $mappingLog->delete();
36
        }
37 3
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end delete()
Loading history...
38
    
39
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
40
     * @inheritdoc
41
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
42 12
    public function all(): array
43
    {
44 12
        return MappingLog::all(['id', 'mapping'])->toArray();
0 ignored issues
show
Coding Style introduced by
Short array syntax is not allowed
Loading history...
45
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end all()
Loading history...
46
    
47
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
48
     * @inheritdoc
49
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
50 3
    public function reset()
51
    {
52 3
        DB::table('triadev_mapping_log')->truncate();
53 3
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 0 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end reset()
Loading history...
54
}
0 ignored issues
show
Coding Style introduced by
Expected //end class
Loading history...
Coding Style introduced by
As per coding style, files should not end with a newline character.

This check marks files that end in a newline character, i.e. an empy line.

Loading history...
55