Code Duplication    Length = 39-39 lines in 2 locations

PHPCompatibility/Sniffs/PHP/DeprecatedIniDirectivesSniff.php 1 location

@@ 230-268 (lines=39) @@
227
     *
228
     * @return void
229
     */
230
    public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
231
    {
232
        $tokens = $phpcsFile->getTokens();
233
234
        $ignore = array(
235
            T_DOUBLE_COLON,
236
            T_OBJECT_OPERATOR,
237
            T_FUNCTION,
238
            T_CONST,
239
        );
240
241
        $prevToken = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true);
242
        if (in_array($tokens[$prevToken]['code'], $ignore) === true) {
243
            // Not a call to a PHP function.
244
            return;
245
        }
246
247
        $functionLc = strtolower($tokens[$stackPtr]['content']);
248
        if (isset($this->iniFunctions[$functionLc]) === false) {
249
            return;
250
        }
251
252
        $iniToken = $this->getFunctionCallParameter($phpcsFile, $stackPtr, $this->iniFunctions[$functionLc]);
253
        if ($iniToken === false) {
254
            return;
255
        }
256
257
        $filteredToken = $this->stripQuotes($iniToken['raw']);
258
        if (isset($this->deprecatedIniDirectives[$filteredToken]) === false) {
259
            return;
260
        }
261
262
        $itemInfo = array(
263
            'name'       => $filteredToken,
264
            'functionLc' => $functionLc,
265
        );
266
        $this->handleFeature($phpcsFile, $iniToken['end'], $itemInfo);
267
268
    }//end process()
269
270
271
    /**

PHPCompatibility/Sniffs/PHP/NewIniDirectivesSniff.php 1 location

@@ 487-525 (lines=39) @@
484
     *
485
     * @return void
486
     */
487
    public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
488
    {
489
        $tokens = $phpcsFile->getTokens();
490
491
        $ignore = array(
492
            T_DOUBLE_COLON,
493
            T_OBJECT_OPERATOR,
494
            T_FUNCTION,
495
            T_CONST,
496
        );
497
498
        $prevToken = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true);
499
        if (in_array($tokens[$prevToken]['code'], $ignore) === true) {
500
            // Not a call to a PHP function.
501
            return;
502
        }
503
504
        $functionLc = strtolower($tokens[$stackPtr]['content']);
505
        if (isset($this->iniFunctions[$functionLc]) === false) {
506
            return;
507
        }
508
509
        $iniToken = $this->getFunctionCallParameter($phpcsFile, $stackPtr, $this->iniFunctions[$functionLc]);
510
        if ($iniToken === false) {
511
            return;
512
        }
513
514
        $filteredToken = $this->stripQuotes($iniToken['raw']);
515
        if (isset($this->newIniDirectives[$filteredToken]) === false) {
516
            return;
517
        }
518
519
        $itemInfo = array(
520
            'name'       => $filteredToken,
521
            'functionLc' => $functionLc,
522
        );
523
        $this->handleFeature($phpcsFile, $iniToken['end'], $itemInfo);
524
525
    }//end process()
526
527
528
    /**