Code Duplication    Length = 17-17 lines in 2 locations

src/Histogram/Histogram3D.php 1 location

@@ 220-236 (lines=17) @@
217
     * @param   string  $separator  the separator, default ", "
218
     * @return  mixed  a string on success, a \PEAR_Error object otherwise
219
     */
220
    public function toSeparated($mode = self::HISTOGRAM_MID_BINS, $separator = ", ")
221
    {
222
        try {
223
            $bins = $this->getBins($mode);
224
        } catch (\PEAR_Exception $e) {
225
            return $bins;
226
        }
227
        
228
229
        $nbins = count($bins);
230
        $out   = array("# x_bin{$separator}y_bin{$separator}frequency");
231
        for ($i = 0; $i < $nbins; $i++) {
232
            $out[] = implode($separator, $bins[$i]);
233
        }
234
235
        return implode("\n", $out) . "\n";
236
    }
237
238
    /**
239
     * Returns the minimum and maximum of the given unidimensional numeric

src/Histogram/Histogram4D.php 1 location

@@ 237-253 (lines=17) @@
234
     * @param   string  $separator  the separator, default ", "
235
     * @return  mixed  a string on success, a \PEAR_Error object otherwise
236
     */
237
    public function toSeparated($mode = self::HISTOGRAM_MID_BINS, $separator = ", ")
238
    {
239
        try {
240
            $bins = $this->getBins($mode);
241
        } catch (\PEAR_Exception $e) {
242
            return $bins;
243
        }
244
        
245
246
        $nbins = count($bins);
247
        $out   = array("# x_bin{$separator}y_bin{$separator}z_bin{$separator}frequency");
248
        for ($i = 0; $i < $nbins; $i++) {
249
            $out[] = implode($separator, $bins[$i]);
250
        }
251
252
        return implode("\n", $out) . "\n";
253
    }
254
255
    /**
256
     * Returns the minimum and maximum of the given unidimensional numeric