Skip to content

Commit 7409bbc

Browse files
committed
Fixed phpcs error reporting.
1 parent 98e2ddf commit 7409bbc

File tree

2 files changed

+74
-73
lines changed

2 files changed

+74
-73
lines changed

classes/Visualizer/Module/Sources.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
// +----------------------------------------------------------------------+
1919
// | Author: Eugene Manuilov <[email protected]> |
2020
// +----------------------------------------------------------------------+
21-
2221
/**
2322
* Sources module class.
2423
*

classes/Visualizer/Source.php

Lines changed: 74 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<?php
2-
32
// +----------------------------------------------------------------------+
43
// | Copyright 2013 Madpixels (email : [email protected]) |
54
// +----------------------------------------------------------------------+
@@ -30,6 +29,15 @@
3029
*/
3130
abstract class Visualizer_Source {
3231

32+
/**
33+
* The array of allowed types.
34+
*
35+
* @since 1.0.0
36+
*
37+
* @access protected
38+
* @var array
39+
*/
40+
protected static $allowed_types = array( 'string', 'number', 'boolean', 'date', 'datetime', 'timeofday' );
3341
/**
3442
* The array of data.
3543
*
@@ -39,7 +47,6 @@ abstract class Visualizer_Source {
3947
* @var array
4048
*/
4149
protected $_data = array();
42-
4350
/**
4451
* The array of series.
4552
*
@@ -51,14 +58,39 @@ abstract class Visualizer_Source {
5158
protected $_series = array();
5259

5360
/**
54-
* The array of allowed types.
61+
* Return allowed types
5562
*
56-
* @since 1.0.0
63+
* @since 1.0.1
64+
*
65+
* @static
66+
* @access public
67+
* @return array the allowed types
68+
*/
69+
public static function getAllowedTypes() {
70+
return self::$allowed_types;
71+
}
72+
73+
/**
74+
* Validates series tyeps.
75+
*
76+
* @since 1.0.1
5777
*
78+
* @static
5879
* @access protected
59-
* @var array
80+
*
81+
* @param array $types The icoming series types.
82+
*
83+
* @return boolean TRUE if sereis types are valid, otherwise FALSE.
6084
*/
61-
protected static $allowed_types = array( 'string', 'number', 'boolean', 'date', 'datetime', 'timeofday' );
85+
protected static function _validateTypes( $types ) {
86+
foreach ( $types as $type ) {
87+
if ( ! in_array( $type, self::$allowed_types ) ) {
88+
return false;
89+
}
90+
}
91+
92+
return true;
93+
}
6294

6395
/**
6496
* Returns source name.
@@ -117,13 +149,47 @@ public function getRawData() {
117149
return $this->_data;
118150
}
119151

152+
/**
153+
* Re populates series if the source is dynamic.
154+
*
155+
* @since 1.1.0
156+
*
157+
* @access public
158+
*
159+
* @param array $series The actual array of series.
160+
* @param int $chart_id The chart id.
161+
*
162+
* @return array The re populated array of series or old one.
163+
*/
164+
public function repopulateSeries( $series, $chart_id ) {
165+
return $series;
166+
}
167+
168+
/**
169+
* Re populates data if the source is dynamic.
170+
*
171+
* @since 1.1.0
172+
*
173+
* @access public
174+
*
175+
* @param array $data The actual array of data.
176+
* @param int $chart_id The chart id.
177+
*
178+
* @return array The re populated array of data or old one.
179+
*/
180+
public function repopulateData( $data, $chart_id ) {
181+
return $data;
182+
}
183+
120184
/**
121185
* Normalizes values according to series' type.
122186
*
123187
* @since 1.0.0
124188
*
125189
* @access protected
190+
*
126191
* @param array $data The row of data.
192+
*
127193
* @return array Normalized row of data.
128194
*/
129195
protected function _normalizeData( $data ) {
@@ -134,14 +200,12 @@ protected function _normalizeData( $data ) {
134200
if ( ! isset( $data[ $i ] ) ) {
135201
$data[ $i ] = null;
136202
}
137-
138203
if ( is_null( $data[ $i ] ) ) {
139204
continue;
140205
}
141-
142206
switch ( $series['type'] ) {
143207
case 'number':
144-
$data[ $i ] = ( is_numeric( $data[ $i ] ) ) ? floatval( $data[ $i ] ) : (is_numeric( str_replace( ',', '', $data[ $i ] ) ) ? floatval( str_replace( ',', '', $data[ $i ] ) ) : null);
208+
$data[ $i ] = ( is_numeric( $data[ $i ] ) ) ? floatval( $data[ $i ] ) : ( is_numeric( str_replace( ',', '', $data[ $i ] ) ) ? floatval( str_replace( ',', '', $data[ $i ] ) ) : null );
145209
break;
146210
case 'boolean':
147211
$data[ $i ] = ! empty( $data[ $i ] ) ? filter_validate( $data[ $i ], FILTER_VALIDATE_BOOLEAN ) : null;
@@ -159,70 +223,8 @@ protected function _normalizeData( $data ) {
159223
break;
160224
}
161225
}
162-
// error_log(print_r($data,true));
163-
return $data;
164-
}
165-
166-
/**
167-
* Validates series tyeps.
168-
*
169-
* @since 1.0.1
170-
*
171-
* @static
172-
* @access protected
173-
* @param array $types The icoming series types.
174-
* @return boolean TRUE if sereis types are valid, otherwise FALSE.
175-
*/
176-
protected static function _validateTypes( $types ) {
177-
foreach ( $types as $type ) {
178-
if ( ! in_array( $type, self::$allowed_types ) ) {
179-
return false;
180-
}
181-
}
182-
183-
return true;
184-
}
185-
186-
/**
187-
* Return allowed types
188-
*
189-
* @since 1.0.1
190-
*
191-
* @static
192-
* @access public
193-
* @return array the allowed types
194-
*/
195-
public static function getAllowedTypes() {
196-
return self::$allowed_types;
197-
}
198-
199-
200-
201-
/**
202-
* Re populates series if the source is dynamic.
203-
*
204-
* @since 1.1.0
205-
*
206-
* @access public
207-
* @param array $series The actual array of series.
208-
* @param int $chart_id The chart id.
209-
* @return array The re populated array of series or old one.
210-
*/
211-
public function repopulateSeries( $series, $chart_id ) {
212-
return $series;
213-
}
214226

215-
/**
216-
* Re populates data if the source is dynamic.
217-
*
218-
* @since 1.1.0
219-
*
220-
* @access public
221-
* @param array $data The actual array of data.
222-
* @param int $chart_id The chart id.
223-
* @return array The re populated array of data or old one.
224-
*/
225-
public function repopulateData( $data, $chart_id ) {
227+
// error_log(print_r($data,true));
226228
return $data;
227229
}
228230

0 commit comments

Comments
 (0)