[TASK] Remove t3lib_div::intInRange()
authorChristian Kuhn <lolli@schwarzbu.ch>
Sat, 14 Apr 2012 10:48:33 +0000 (12:48 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sat, 14 Apr 2012 10:51:16 +0000 (12:51 +0200)
The method is scheduled for deletion in 6.0 but was still used in the core.
The patch adapts the usages and removes intInRange.

Change-Id: Id4724c566f61c5a7238ea29be6f385bdc99d8876
Resolves: #36029
Releases: 6.0
Reviewed-on: http://review.typo3.org/10454
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
t3lib/class.t3lib_div.php
tests/t3lib/class.t3lib_divTest.php
typo3/sysext/indexed_search/Classes/Controller/SearchController.php
typo3/sysext/indexed_search/Classes/Domain/Repository/IndexSearchRepository.php
typo3/sysext/indexed_search/Classes/ViewHelpers/PageBrowsingViewHelper.php

index fb3f694..478be2d 100644 (file)
@@ -835,21 +835,6 @@ final class t3lib_div {
        }
 
        /**
-        * Forces the integer $theInt into the boundaries of $min and $max. If the $theInt is 'FALSE' then the $zeroValue is applied.
-        *
-        * @param integer $theInt Input value
-        * @param integer $min Lower limit
-        * @param integer $max Higher limit
-        * @param integer $zeroValue Default value if input is FALSE.
-        * @return integer The input value forced into the boundaries of $min and $max
-        * @deprecated since TYPO3 4.6, will be removed in TYPO3 4.8 - Use t3lib_utility_Math::forceIntegerInRange() instead
-        */
-       public static function intInRange($theInt, $min, $max = 2000000000, $zeroValue = 0) {
-               self::logDeprecatedFunction();
-               return t3lib_utility_Math::forceIntegerInRange($theInt, $min, $max, $zeroValue);
-       }
-
-       /**
         * Returns an integer from a three part version number, eg '4.12.3' -> 4012003
         *
         * @param string $verNumberStr Version number on format x.x.x
index 8e1111c..3fae21d 100644 (file)
@@ -684,39 +684,6 @@ class t3lib_divTest extends tx_phpunit_testcase {
        }
 
        //////////////////////////////////
-       // Tests concerning intInRange
-       //////////////////////////////////
-       /**
-        * Data provider for intInRangeForcesIntegerIntoBoundaries
-        *
-        * @return array expected values, arithmetic expression
-        */
-       public function intInRangeForcesIntegerIntoDefaultBoundariesDataProvider() {
-               return array(
-                       'negativeValue' => array(0, -10),
-                       'normalValue' => array(30, 30),
-                       'veryHighValue' => array(2000000000, 3000000001),
-                       'zeroValue' => array(0, 0),
-                       'anotherNormalValue' => array(12309, 12309)
-               );
-       }
-
-       /**
-        * @test
-        * @dataProvider intInRangeForcesIntegerIntoDefaultBoundariesDataProvider
-        */
-       public function intInRangeForcesIntegerIntoDefaultBoundaries($expected, $value) {
-               $this->assertEquals($expected, t3lib_div::intInRange($value, 0));
-       }
-
-       /**
-        * @test
-        */
-       public function intInRangeSetsDefaultValueIfZeroValueIsGiven() {
-               $this->assertEquals(42, t3lib_div::intInRange('', 0, 2000000000, 42));
-       }
-
-       //////////////////////////////////
        // Tests concerning int_from_ver
        //////////////////////////////////
        /**
index 04d1db0..37067c6 100644 (file)
@@ -137,7 +137,7 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
                        $searchData['freeIndexUid'] = $searchData['_freeIndexUid'];
                }
 
-               $searchData['results'] = t3lib_div::intInRange($searchData['results'], 1, 100000, $this->defaultResultNumber);
+               $searchData['results'] = t3lib_utility_Math::forceIntegerInRange($searchData['results'], 1, 100000, $this->defaultResultNumber);
 
 
                        // This gets the search-words into the $searchWordArray
@@ -545,7 +545,7 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
 
                                // Close to top of page
                        case 'rank_first':
-                               return ceil(t3lib_div::intInRange(255 - $row['order_val'], 1, 255) / 255 * 100) . '%';
+                               return ceil(t3lib_utility_Math::forceIntegerInRange(255 - $row['order_val'], 1, 255) / 255 * 100) . '%';
                        break;
 
                                // Based on priority assigned to <title> / <meta-keywords> / <meta-description> / <body>
@@ -555,7 +555,7 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
                                        $base = $row['order_val1'] * 256;
                                                // 15-3 MSB = 12
                                        $freqNumber = $row['order_val2'] / $this->firstRow['order_val2'] * pow(2, 12);
-                                       $total = t3lib_div::intInRange($base + $freqNumber, 0, 32767);
+                                       $total = t3lib_utility_Math::forceIntegerInRange($base + $freqNumber, 0, 32767);
                                        return ceil(log($total) / log(32767) * 100) . '%';
                                }
                        break;
@@ -563,7 +563,7 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
                                // Based on frequency
                        case 'rank_freq':
                                $max = 10000;
-                               $total = t3lib_div::intInRange($row['order_val'], 0, $max);
+                               $total = t3lib_utility_Math::forceIntegerInRange($row['order_val'], 0, $max);
                                return ceil(log($total) / log($max) * 100) . '%';
                        break;
 
@@ -756,7 +756,7 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
 
                $occurencies = (count($parts)-1)/2;
                if ($occurencies) {
-                       $postPreLgd = t3lib_div::intInRange($summaryMax / $occurencies, $postPreLgd, $summaryMax / 2);
+                       $postPreLgd = t3lib_utility_Math::forceIntegerInRange($summaryMax / $occurencies, $postPreLgd, $summaryMax / 2);
                }
 
                        // Variable:
@@ -1584,4 +1584,4 @@ if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLA
 }
 
 
-?>
+?>
\ No newline at end of file
index 6504e12..38496e5 100644 (file)
@@ -168,7 +168,7 @@ class Tx_IndexedSearch_Domain_Repository_IndexSearchRepository {
                        $count = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
 
                                // The pointer is set to the result page that is currently being viewed
-                       $pointer = t3lib_div::intInRange($this->resultpagePointer, 0, floor($count / $this->resultsPerPage));
+                       $pointer = t3lib_utility_Math::forceIntegerInRange($this->resultpagePointer, 0, floor($count / $this->resultsPerPage));
 
                                // Initialize result accumulation variables:
                        $c = 0; // Result pointer: Counts up the position in the current search-result
@@ -909,4 +909,4 @@ if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLA
 }
 
 
-?>
+?>
\ No newline at end of file
index 8633305..fc25895 100644 (file)
@@ -48,7 +48,7 @@ class Tx_IndexedSearch_ViewHelpers_PageBrowsingViewHelper extends Tx_Fluid_Core_
         * @return the content
         */
        public function render($maximumNumberOfResultPages, $numberOfResults, $resultsPerPage, $currentPage = 1) {
-               $maximumNumberOfResultPages = t3lib_div::intInRange($maximumNumberOfResultPages, 1, 100, 10);
+               $maximumNumberOfResultPages = t3lib_utility_Math::forceIntegerInRange($maximumNumberOfResultPages, 1, 100, 10);
 
                $pageCount = ceil($numberOfResults / $resultsPerPage);