Conditions | 7 |
Paths | 64 |
Total Lines | 20 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
16 | public function after_save(\Orm\Model $obj) |
||
17 | { |
||
18 | |||
19 | $save_data = array(); |
||
20 | foreach(array_keys($obj->properties()) as $p){ |
||
21 | $save_data[$p] = $obj->{$p}; |
||
22 | } |
||
23 | |||
24 | $host = empty(self::$td_config['host']) ? null : self::$td_config['host']; |
||
25 | $port = empty(self::$td_config['port']) ? null : self::$td_config['port']; |
||
26 | $options = empty(self::$td_config['options']) ? array() : self::$td_config['options']; |
||
27 | $packer = empty(self::$td_config['packer']) ? null : self::$td_config['packer']; |
||
28 | $database = empty(self::$td_config['database']) ? 'default' : self::$td_config['database']; |
||
29 | $table_name = $obj->table(); |
||
30 | |||
31 | \Fluent\Autoloader::register(); |
||
32 | $logger = new \Fluent\Logger\FluentLogger($host,$port,$options,$packer); |
||
33 | $res = $logger->post('td.'.$database.'.'.$table_name,$save_data); |
||
|
|||
34 | |||
35 | } |
||
36 | } |
||
37 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.