-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFillNull.php
More file actions
56 lines (52 loc) · 1.61 KB
/
FillNull.php
File metadata and controls
56 lines (52 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
/**
* This file contains FillNull process
*
* @author KoolPHP Inc (support@koolphp.net)
* @link https://www.koolphp.net
* @copyright KoolPHP Inc
* @license https://www.koolreport.com/license
*/
namespace koolreport\cleandata;
use \koolreport\core\ProcessGroup;
use \koolreport\core\Utility;
class FillNull extends ProcessGroup
{
const MEAN="~FILLNULLMEAN";
const MEDIAN="~FILLNULLMEDIAN";
protected $targetValue;
protected $newValue;
protected $targetColumns;
protected $excludedColumns;
protected $targetColumnType;
protected function onInit()
{
$this->newValue = Utility::get($this->params,"newValue");
if($this->newValue===null)
{
throw new \Exception("Please specify newValue in FillNull process");
}
$this->targetValue = Utility::get($this->params,"targetValue");
$this->targetColumnType = Utility::get($this->params,"targetColumnType");
$this->targetColumns = Utility::get($this->params,"targetColumns");
$this->excludedColumns = Utility::get($this->params,"excludedColumns");
}
public function setup()
{
switch($this->newValue)
{
case FillNull::MEAN:
case FillNull::MEDIAN:
$this->incoming()
->pipe(new Describe($this->params))
->pipe(new DoFill($this->params))
->pipe($this->outcoming());
break;
default:
$this->incoming()
->pipe(new DoFill($this->params))
->pipe($this->outcoming());
break;
}
}
}