| @@ -18,8 +18,9 @@ | ||
| 18 | 18 | // | MA 02110-1301 USA | |
| 19 | 19 | // +----------------------------------------------------------------------+ |
| 20 | 20 | // | Author: Eugene Manuilov <eugene@manuilov.org> | |
| 21 | 21 | // +----------------------------------------------------------------------+ |
| 22 | + | |
| 22 | 23 | /** |
| 23 | 24 | * Source manager for local CSV files. |
| 24 | 25 | * |
| 25 | 26 | * @category Visualizer |
| @@ -64,15 +65,15 @@ | ||
| 64 | 65 | $labels = fgetcsv( $handle, 0, VISUALIZER_CSV_DELIMITER, VISUALIZER_CSV_ENCLOSURE ); |
| 65 | 66 | // read series types |
| 66 | 67 | $types = fgetcsv( $handle, 0, VISUALIZER_CSV_DELIMITER, VISUALIZER_CSV_ENCLOSURE ); |
| 67 | 68 | |
| 68 | - if ( ! $labels || ! $types ) { | |
| 69 | + if ( !$labels || !$types ) { | |
| 69 | 70 | return false; |
| 70 | 71 | } |
| 71 | 72 | |
| 72 | 73 | // if no types were setup, re read labels and empty types array |
| 73 | 74 | $types = array_map( 'trim', $types ); |
| 74 | - if ( ! self::_validateTypes( $types ) ) { | |
| 75 | + if ( !self::_validateTypes( $types ) ) { | |
| 75 | 76 | // re open the file |
| 76 | 77 | fclose( $handle ); |
| 77 | 78 | $handle = $this->_get_file_handle(); |
| 78 | 79 | |
| @@ -83,10 +84,10 @@ | ||
| 83 | 84 | |
| 84 | 85 | for ( $i = 0, $len = count( $labels ); $i < $len; $i++ ) { |
| 85 | 86 | $default_type = $i == 0 ? 'string' : 'number'; |
| 86 | 87 | $this->_series[] = array( |
| 87 | - 'label' => $labels[ $i ], | |
| 88 | - 'type' => isset( $types[ $i ] ) ? $types[ $i ] : $default_type, | |
| 88 | + 'label' => $labels[$i], | |
| 89 | + 'type' => isset( $types[$i] ) ? $types[$i] : $default_type, | |
| 89 | 90 | ); |
| 90 | 91 | } |
| 91 | 92 | |
| 92 | 93 | return true; |
| @@ -102,9 +103,9 @@ | ||
| 102 | 103 | * @return resource File handle resource on success, otherwise FALSE. |
| 103 | 104 | */ |
| 104 | 105 | protected function _get_file_handle( $filename = false ) { |
| 105 | 106 | // set line endings auto detect mode |
| 106 | - ini_set( 'auto_detect_line_endings', true ); | |
| 107 | + @ini_set( 'auto_detect_line_endings', true ); | |
| 107 | 108 | // open file and return handle |
| 108 | 109 | return fopen( $filename ? $filename : $this->_filename, 'rb' ); |
| 109 | 110 | } |
| 110 | 111 | |
| @@ -125,15 +126,14 @@ | ||
| 125 | 126 | // read file and fill arrays |
| 126 | 127 | $handle = $this->_get_file_handle(); |
| 127 | 128 | if ( $handle ) { |
| 128 | 129 | // fetch series |
| 129 | - if ( ! $this->_fetchSeries( $handle ) ) { | |
| 130 | + if ( !$this->_fetchSeries( $handle ) ) { | |
| 130 | 131 | return false; |
| 131 | 132 | } |
| 132 | 133 | |
| 133 | 134 | // fetch data |
| 134 | 135 | while ( ( $data = fgetcsv( $handle, 0, VISUALIZER_CSV_DELIMITER, VISUALIZER_CSV_ENCLOSURE ) ) !== false ) { |
| 135 | - | |
| 136 | 136 | $this->_data[] = $this->_normalizeData( $data ); |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | // close file handle |
| @@ -154,5 +154,5 @@ | ||
| 154 | 154 | public function getSourceName() { |
| 155 | 155 | return __CLASS__; |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | -} | |
| 158 | +} | |