Code Duplication    Length = 39-39 lines in 2 locations

Sniffs/PHP/DeprecatedIniDirectivesSniff.php 1 location

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

Sniffs/PHP/NewIniDirectivesSniff.php 1 location

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