Code Duplication    Length = 39-39 lines in 2 locations

Sniffs/PHP/DeprecatedIniDirectivesSniff.php 1 location

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

Sniffs/PHP/NewIniDirectivesSniff.php 1 location

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