Code Duplication    Length = 39-39 lines in 2 locations

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
    /**

PHPCompatibility/Sniffs/PHP/DeprecatedIniDirectivesSniff.php 1 location

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