Code Duplication    Length = 14-16 lines in 8 locations

main/inc/lib/pear/HTML/Table.php 8 locations

@@ 326-340 (lines=15) @@
323
     * @access  public
324
     * @throws  PEAR_Error
325
     */
326
    function setAutoFill($fill, $body = null)
327
    {
328
        if (!is_null($body)) {
329
            $ret = $this->_adjustTbodyCount($body, 'setAutoFill');
330
            if (PEAR::isError($ret)) {
331
                return $ret;
332
            }
333
            $this->_tbodies[$body]->setAutoFill($fill);
334
        } else {
335
            $this->_autoFill = $fill;
336
            for ($i = 0; $i < $this->_tbodyCount; $i++) {
337
                $this->_tbodies[$i]->setAutoFill($fill);
338
            }
339
        }
340
    }
341
342
    /**
343
     * Returns the autoFill value
@@ 371-385 (lines=15) @@
368
     * @access   public
369
     * @throws   PEAR_Error
370
     */
371
    function setAutoGrow($grow, $body = null)
372
    {
373
        if (!is_null($body)) {
374
            $ret = $this->_adjustTbodyCount($body, 'setAutoGrow');
375
            if (PEAR::isError($ret)) {
376
                return $ret;
377
            }
378
            $this->_tbodies[$body]->setAutoGrow($grow);
379
        } else {
380
            $this->_autoGrow = $grow;
381
            for ($i = 0; $i < $this->_tbodyCount; $i++) {
382
                $this->_tbodies[$i]->setAutoGrow($grow);
383
            }
384
        }
385
    }
386
387
    /**
388
     * Returns the autoGrow value
@@ 449-464 (lines=16) @@
446
     * @return   int
447
     * @throws   PEAR_Error
448
     */
449
    function getRowCount($body = null)
450
    {
451
        if (!is_null($body)) {
452
            $ret = $this->_adjustTbodyCount($body, 'getRowCount');
453
            if (PEAR::isError($ret)) {
454
                return $ret;
455
            }
456
            return $this->_tbodies[$body]->getRowCount();
457
        } else {
458
            $rowCount = 0;
459
            for ($i = 0; $i < $this->_tbodyCount; $i++) {
460
                $rowCount += $this->_tbodies[$i]->getRowCount();
461
            }
462
            return $rowCount;
463
        }
464
    }
465
466
    /**
467
     * Gets the number of columns in the table
@@ 513-526 (lines=14) @@
510
     * @access   public
511
     * @throws   PEAR_Error
512
     */
513
    function setColType($col, $type, $body = null)
514
    {
515
        if (!is_null($body)) {
516
            $ret = $this->_adjustTbodyCount($body, 'setColType');
517
            if (PEAR::isError($ret)) {
518
                return $ret;
519
            }
520
            $this->_tbodies[$body]->setColType($col, $type);
521
        } else {
522
            for ($i = 0; $i < $this->_tbodyCount; $i++) {
523
                $this->_tbodies[$i]->setColType($col, $type);
524
            }
525
        }
526
    }
527
528
    /**
529
     * Sets the cell attributes for an existing cell.
@@ 835-848 (lines=14) @@
832
     * @access   public
833
     * @throws   PEAR_Error
834
     */
835
    function setColAttributes($col, $attributes = null, $body = null)
836
    {
837
        if (!is_null($body)) {
838
            $ret = $this->_adjustTbodyCount($body, 'setColAttributes');
839
            if (PEAR::isError($ret)) {
840
                return $ret;
841
            }
842
            $this->_tbodies[$body]->setColAttributes($col, $attributes);
843
        } else {
844
            for ($i = 0; $i < $this->_tbodyCount; $i++) {
845
                $this->_tbodies[$i]->setColAttributes($col, $attributes);
846
            }
847
        }
848
    }
849
850
    /**
851
     * Updates the column attributes for an existing column
@@ 860-873 (lines=14) @@
857
     * @access   public
858
     * @throws   PEAR_Error
859
     */
860
    function updateColAttributes($col, $attributes = null, $body = null)
861
    {
862
        if (!is_null($body)) {
863
            $ret = $this->_adjustTbodyCount($body, 'updateColAttributes');
864
            if (PEAR::isError($ret)) {
865
                return $ret;
866
            }
867
            $this->_tbodies[$body]->updateColAttributes($col, $attributes);
868
        } else {
869
            for ($i = 0; $i < $this->_tbodyCount; $i++) {
870
                $this->_tbodies[$i]->updateColAttributes($col, $attributes);
871
            }
872
        }
873
    }
874
875
    /**
876
     * Sets the attributes for all cells
@@ 884-897 (lines=14) @@
881
     * @access   public
882
     * @throws   PEAR_Error
883
     */
884
    function setAllAttributes($attributes = null, $body = null)
885
    {
886
        if (!is_null($body)) {
887
            $ret = $this->_adjustTbodyCount($body, 'setAllAttributes');
888
            if (PEAR::isError($ret)) {
889
                return $ret;
890
            }
891
            $this->_tbodies[$body]->setAllAttributes($attributes);
892
        } else {
893
            for ($i = 0; $i < $this->_tbodyCount; $i++) {
894
                $this->_tbodies[$i]->setAllAttributes($attributes);
895
            }
896
        }
897
    }
898
899
    /**
900
     * Updates the attributes for all cells
@@ 908-921 (lines=14) @@
905
     * @access   public
906
     * @throws   PEAR_Error
907
     */
908
    function updateAllAttributes($attributes = null, $body = null)
909
    {
910
        if (!is_null($body)) {
911
            $ret = $this->_adjustTbodyCount($body, 'updateAllAttributes');
912
            if (PEAR::isError($ret)) {
913
                return $ret;
914
            }
915
            $this->_tbodies[$body]->updateAllAttributes($attributes);
916
        } else {
917
            for ($i = 0; $i < $this->_tbodyCount; $i++) {
918
                $this->_tbodies[$i]->updateAllAttributes($attributes);
919
            }
920
        }
921
    }
922
923
    /**
924
     * Returns the table structure as HTML