LoggerComponent   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 24
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A log() 0 9 2
A getPlayerParams() 0 11 2
1
<?php
2
class LoggerComponent extends CApplicationComponent
3
{
4
    public function log($data)
5
    {
6
        $params = $this->getPlayerParams();
7
        foreach ($data as $k => $v) {
8
            $params[$k] = $v;
9
        }
10
        
11
        Yii::app()->db->createCommand()->insert('log', $params);
12
    }
13
14
    private function getPlayerParams()
15
    {
16
        $params = ['uid','xp_all','xp_delta','level','energy_max','energy','skill','skill_extended','strength','dollar','gold','owned_items','owned_baits'];
17
18
        $ret = [];
19
        foreach ($params as $param) {
20
            $ret[$param] = Yii::app()->player->model->$param;
21
        }
22
23
        return $ret;
24
    }
25
}
0 ignored issues
show
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...
26