Completed
Push — master ( 1dd400...cdfa80 )
by Alexey
04:26
created

Map   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 13
Duplicated Lines 69.23 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 9
loc 13
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A parseRequest() 9 9 3

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
/**
4
 * Active form input files
5
 *
6
 * @author Alexey Krupskiy <[email protected]>
7
 * @link http://inji.ru/
8
 * @copyright 2015 Alexey Krupskiy
9
 * @license https://github.com/injitools/cms-Inji/blob/master/LICENSE
10
 */
11
12
namespace Ui\ActiveForm\Input;
13
14
class Map extends \Ui\ActiveForm\Input {
15
16 View Code Duplication
  public function parseRequest($request) {
17
    $colName = empty($this->colParams['col']) ? $this->colName : $this->colParams['col'];
18
    if (isset($request[$this->colName])) {
19
      $this->activeForm->model->{$colName} = json_encode($request[$this->colName]);
20
    } else {
21
      $this->activeForm->model->{$colName} = 0;
22
      $this->activeForm->model->{$colName} = '';
23
    }
24
  }
25
26
}
27