Code Duplication    Length = 39-39 lines in 2 locations

Sniffs/PHP/DeprecatedIniDirectivesSniff.php 1 location

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

Sniffs/PHP/NewIniDirectivesSniff.php 1 location

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