Code Duplication    Length = 14-17 lines in 3 locations

src/Standards/BestIt/Sniffs/Formatting/OpenTagSniff.php 2 locations

@@ 140-153 (lines=14) @@
137
     *
138
     * @return void
139
     */
140
    private function handleNoSpaceAfterOpenTag(File $phpcsFile, int $stackPtr, int $whitespacePtr)
141
    {
142
        $fixNoSpaceAfterTag = $phpcsFile->addFixableError(
143
            self::ERROR_NO_SPACE_AFTER_OPEN_TAG,
144
            $whitespacePtr,
145
            self::CODE_NO_SPACE_AFTER_OPEN_TAG
146
        );
147
148
        if ($fixNoSpaceAfterTag) {
149
            $phpcsFile->fixer->beginChangeset();
150
            $phpcsFile->fixer->addNewline($stackPtr);
151
            $phpcsFile->fixer->endChangeset();
152
        }
153
    }
154
155
    /**
156
     * Handles line after open tag not empty.
@@ 163-179 (lines=17) @@
160
     *
161
     * @return void
162
     */
163
    private function handleLineNotEmpty(File $phpcsFile, int $whitespacePtr)
164
    {
165
        $fixSpaceNotScndLine = $phpcsFile->addFixableError(
166
            self::ERROR_LINE_NOT_EMPTY,
167
            $whitespacePtr,
168
            self::CODE_LINE_NOT_EMPTY
169
        );
170
171
        if ($fixSpaceNotScndLine) {
172
            $phpcsFile->fixer->beginChangeset();
173
            $phpcsFile->fixer->replaceToken(
174
                $whitespacePtr,
175
                ''
176
            );
177
            $phpcsFile->fixer->endChangeset();
178
        }
179
    }
180
}
181

src/Standards/BestIt/Sniffs/Formatting/SpaceAfterDeclareSniff.php 1 location

@@ 137-150 (lines=14) @@
134
     *
135
     * @return void
136
     */
137
    private function handleNoWhitespaceFound(File $phpcsFile, int $semicolonPtr)
138
    {
139
        $fixNoWhitespace = $phpcsFile->addFixableError(
140
            self::MESSAGE_NO_WHITESPACE_FOUND,
141
            $semicolonPtr,
142
            self::CODE_NO_WHITESPACE_FOUND
143
        );
144
145
        if ($fixNoWhitespace) {
146
            $phpcsFile->fixer->beginChangeset();
147
            $phpcsFile->fixer->addNewline($semicolonPtr);
148
            $phpcsFile->fixer->endChangeset();
149
        }
150
    }
151
152
    /**
153
     * Handles when more than one whitespaces are found.