Passed
Push — master ( 02118d...11fb63 )
by Petr
03:00
created

ADatabase::updateRecordByPk()   C

Complexity

Conditions 14
Paths 41

Size

Total Lines 40
Code Lines 23

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 23
CRAP Score 14

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 14
eloc 23
c 1
b 0
f 0
nc 41
nop 1
dl 0
loc 40
ccs 23
cts 23
cp 1
crap 14
rs 6.2666

How to fix   Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
namespace kalanis\kw_mapper\Mappers\Database;
4
5
6
use kalanis\kw_mapper\MapperException;
7
use kalanis\kw_mapper\Mappers\AMapper;
8
use kalanis\kw_mapper\Storage;
9
10
11
/**
12
 * Class ADatabase
13
 * @package kalanis\kw_mapper\Mappers\Database
14
 */
15
abstract class ADatabase extends AMapper
16
{
17
    use TTable;
18
    use TReadDatabase;
19
    use TWriteDatabase;
20
21
    /**
22
     * @throws MapperException
23
     */
24 12
    public function __construct()
25
    {
26 12
        parent::__construct();
27
28 12
        $this->initTReadDatabase();
29 12
        $this->initTWriteDatabase();
30 12
    }
31
32 36
    public function getAlias(): string
33
    {
34 36
        return $this->getTable();
35
    }
36
37 12
    protected function getReadSource(): string
38
    {
39 12
        return $this->getSource();
40
    }
41
42 12
    protected function getWriteSource(): string
43
    {
44 12
        return $this->getSource();
45
    }
46
}
47