Lines Matching refs:this

129         $this->_currentFile = $phpcsFile;
130 $this->_numFixes = 0;
131 $this->_fixedTokens = array();
134 $this->_tokens = array();
137 $this->_tokens[$index] = $token['orig_content'];
139 $this->_tokens[$index] = $token['content'];
153 $fixable = $this->_currentFile->getFixableCount();
160 $cliValues = $this->_currentFile->phpcs->cli->getCommandLineValues();
165 $this->enabled = true;
167 $this->loops = 0;
168 while ($this->loops < 50) {
172 $contents = $this->getContents();
177 $lines = explode($this->_currentFile->eolChar, $contents);
188 $this->_inConflict = false;
189 $this->_currentFile->refreshTokenListeners();
190 $this->_currentFile->start($contents);
193 $this->loops++;
197 … echo "\t=> Fixing file: $this->_numFixes/$fixable violations remaining [made $this->loops pass";
198 if ($this->loops > 1) {
205 if ($this->_numFixes === 0 && $this->_inConflict === false) {
209 … echo "\t* fixed $this->_numFixes violations, starting loop ".($this->loops + 1).' *'.PHP_EOL;
213 $this->enabled = false;
215 if ($this->_numFixes > 0) {
218 …echo "\t*** Reached maximum number of loops with $this->_numFixes violations left unfixed ***".PHP…
243 $filePath = $this->_currentFile->getFilename();
253 $contents = $this->getContents();
322 return $this->_numFixes;
334 $contents = implode($this->_tokens);
352 if ($this->_inChangeset === true
353 && isset($this->_changeset[$stackPtr]) === true
355 return $this->_changeset[$stackPtr];
357 return $this->_tokens[$stackPtr];
370 if ($this->_inConflict === true) {
384 $this->_changeset = array();
385 $this->_inChangeset = true;
397 if ($this->_inConflict === true) {
401 $this->_inChangeset = false;
405 foreach ($this->_changeset as $stackPtr => $content) {
406 $success = $this->replaceToken($stackPtr, $content);
417 $this->revertToken($stackPtr);
426 $fixes = count($this->_changeset);
432 $this->_changeset = array();
444 $this->_inChangeset = false;
445 $this->_inConflict = false;
447 if (empty($this->_changeset) === false) {
458 $numChanges = count($this->_changeset);
466 $this->_changeset = array();
482 if ($this->_inConflict === true) {
486 if ($this->_inChangeset === false
487 && isset($this->_fixedTokens[$stackPtr]) === true
490 if (empty($this->_changeset) === false) {
513 $tokens = $this->_currentFile->getTokens();
515 $oldContent = PHP_CodeSniffer::prepareForOutput($this->_tokens[$stackPtr]);
517 … if (trim($this->_tokens[$stackPtr]) === '' && isset($this->_tokens[($stackPtr + 1)]) === true) {
519 $append = PHP_CodeSniffer::prepareForOutput($this->_tokens[($stackPtr + 1)]);
525 if ($this->_inChangeset === true) {
526 $this->_changeset[$stackPtr] = $content;
537 if (isset($this->_oldTokenValues[$stackPtr]) === false) {
538 $this->_oldTokenValues[$stackPtr] = array(
540 'prev' => $this->_tokens[$stackPtr],
541 'loop' => $this->loops,
544 if ($this->_oldTokenValues[$stackPtr]['prev'] === $content
545 && $this->_oldTokenValues[$stackPtr]['loop'] === ($this->loops - 1)
549 if (empty($this->_changeset) === false) {
553 $loop = $this->_oldTokenValues[$stackPtr]['loop'];
560 if ($this->_oldTokenValues[$stackPtr]['loop'] >= ($this->loops - 1)) {
561 $this->_inConflict = true;
574 $this->_oldTokenValues[$stackPtr]['prev'] = $this->_oldTokenValues[$stackPtr]['curr'];
575 $this->_oldTokenValues[$stackPtr]['curr'] = $content;
576 $this->_oldTokenValues[$stackPtr]['loop'] = $this->loops;
579 $this->_fixedTokens[$stackPtr] = $this->_tokens[$stackPtr];
580 $this->_tokens[$stackPtr] = $content;
581 $this->_numFixes++;
585 if (empty($this->_changeset) === false) {
608 if (isset($this->_fixedTokens[$stackPtr]) === false) {
622 $tokens = $this->_currentFile->getTokens();
624 $oldContent = PHP_CodeSniffer::prepareForOutput($this->_tokens[$stackPtr]);
625 $newContent = PHP_CodeSniffer::prepareForOutput($this->_fixedTokens[$stackPtr]);
626 … if (trim($this->_tokens[$stackPtr]) === '' && isset($tokens[($stackPtr + 1)]) === true) {
628 $append = PHP_CodeSniffer::prepareForOutput($this->_tokens[($stackPtr + 1)]);
634 $this->_tokens[$stackPtr] = $this->_fixedTokens[$stackPtr];
635 unset($this->_fixedTokens[$stackPtr]);
636 $this->_numFixes--;
640 if (empty($this->_changeset) === false) {
666 $current = $this->getTokenContent($stackPtr);
674 return $this->replaceToken($stackPtr, $newContent);
688 $current = $this->getTokenContent($stackPtr);
689 return $this->replaceToken($stackPtr, $current.$this->_currentFile->eolChar);
703 $current = $this->getTokenContent($stackPtr);
704 return $this->replaceToken($stackPtr, $this->_currentFile->eolChar.$current);
719 $current = $this->getTokenContent($stackPtr);
720 return $this->replaceToken($stackPtr, $current.$content);
735 $current = $this->getTokenContent($stackPtr);
736 return $this->replaceToken($stackPtr, $content.$current);