Completed
Push — trunk ( 1f2f20...9c1015 )
by SuperNova.WS
04:43
created

DbFieldDescription::fromMySqlDescription()   C

Complexity

Conditions 10
Paths 512

Size

Total Lines 13
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 110

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 10
eloc 11
nc 512
nop 1
dl 0
loc 13
rs 5.7204
c 1
b 0
f 0
ccs 0
cts 11
cp 0
crap 110

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
 * Created by Gorlum 04.10.2017 8:55
4
 */
5
6
namespace DBAL;
7
8
/**
9
 * Class DbFieldDescription
10
 * @package DBAL
11
 *
12
 * Objects of this class contains MySql field description
13
 */
14
class DbFieldDescription {
15
  public $Field;
16
  public $Type;
17
  public $Collation;
18
  public $Null;
19
  public $Key;
20
  public $Default;
21
  public $Extra;
22
  public $Privileges;
23
  public $Comment;
24
25
  /**
26
   * @param array $mySqlDescription
27
   */
28
  public function fromMySqlDescription($mySqlDescription) {
29
    $this->Field = isset($mySqlDescription['Field']) ? $mySqlDescription['Field'] : null;
30
    $this->Type = isset($mySqlDescription['Type']) ? $mySqlDescription['Type'] : null;
31
    $this->Collation = isset($mySqlDescription['Collation']) ? $mySqlDescription['Collation'] : null;
32
    $this->Null = isset($mySqlDescription['Null']) ? $mySqlDescription['Null'] : null;
33
    $this->Key = isset($mySqlDescription['Key']) ? $mySqlDescription['Key'] : null;
34
    $this->Default = isset($mySqlDescription['Default']) ? $mySqlDescription['Default'] : null;
35
    $this->Extra = isset($mySqlDescription['Extra']) ? $mySqlDescription['Extra'] : null;
36
    $this->Privileges = isset($mySqlDescription['Privileges']) ? $mySqlDescription['Privileges'] : null;
37
    $this->Comment = isset($mySqlDescription['Comment']) ? $mySqlDescription['Comment'] : null;
38
39
    return $this;
40
  }
41
42
}
43