Run the below given command
sudo apt-get install subversion
Run the below given command
sudo apt-get install subversion
Paragraph
Next – }
Previous – {
Sentence
Next sentance – )
Previous sentance – (
Inserting and appending text
inserts text to the left of cursor – i
nserts in the beginning of line -I
appends text to right of cursor -a
appends to the end of line- A
Adding new line
add a new line below the current line -o
adds a new line above the current line – O
file
Go to end of file – :$
on chacter forword – :w
One word forword – :W
go to a line number – :ine_number
display file info – :^g
Moving Cursor in File
Left – h
Right – l
Up – k
Down – j
Line
Beginning – ^ or B
end – $
Deleting the text :
deletes text above the text – x
deletes text character on right of cursor- X
deletes line- 20 20d
deletes current line- dd
delete till end of current -line. D
Replacing a character & word
replace the character above the cursor – r
replces characters until Esc is pressed – R
replaces the word from cursor to the end indicated by $ sign – cw
replaces till end of line – C
Substitute
subistutes current charcater – s
substitutes entire line – S
Undo last changes
undo last change – u
undo changes to the current line – U
Copy and pasting lines
copys the current line into buffer – yy
copies 5 lines from the current line – 5yy
pastes the current buffer – p
Searching
Searches for the word name in the file – /name
n continues search forward – n
N searches backwards – N
Saving
saves the text does not quit -:w
saves & quit the editor – :wq!
save ZZ
Quit without saving – q!
Search & Replace – s/<search>/<replace>/g .
Repeating last command .
Recovering a unsaved vi file – vi -r filename
Please follow the below given steps
1) Find out the location of PHP_CodeSniffer install .
locate PHP_CodeSniffer
2) Change the directory to install
cd path/to/PHP_CodeSniffer
3) Create a directory that represent the new coding standard and change the directory to it
sudo mkdir PHPCodezStandard
cd PHPCodezStandard
4) Create the directory sniff that is used to store all the sniff files for this coding standard and change the directory to it
sudo mkdir Sniffs
5) Create a file ruleset.xml
sudo vi ruleset.xml
6) Paste the below given content in ruleset.xml
<?xml version=”1.0″?>
<ruleset name=”PHPCodezStandard”>
<description>New coding standard.</description>
</ruleset>
Then change the directory to Sniffs
cd Sniffs
7) Create the sniff that require a single php file and it’s name should be end with Sniff.php and should be placed in a subdirectory
sudo mkdir Commenting
cd Commenting
sudo vi PHPCodezSniff.php
8 ) Paste the below given code in PHPCodezSniff.php
<?php
class PHPCodezStandard_Sniffs_Commenting_PHPCOdezSniff implements PHP_CodeSniffer_Sniff
{
public function register() {
return array(T_COMMENT);
}
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr){
$tokens = $phpcsFile->getTokens();
if ($tokens[$stackPtr][‘content’]{0} === ‘#’) {
$error = ‘Hash comments are prohibited; found %s’;
$data = array(trim($tokens[$stackPtr][‘content’]));
$phpcsFile->addError($error, $stackPtr, ‘Found’, $data);
}
}
}
?>
10) You can use this standard as follows
phpcs –standard=/usr/share/php/data/PHP_CodeSniffer/PHPCodezStandard exception.php
FILE: /var/www/test/exception.php
——————————————————————————–
FOUND 1 ERROR(S) AFFECTING 1 LINE(S)
——————————————————————————–
2 | ERROR | Hash comments are prohibited; found #
——————————————————————————–
It find out the minimum version and the extensions required for a piece of code to run
PHP_Compat provides missing functionality in the form of functions and constants for older versions of PHP.
The replicated functions are designed to be interchangable with their native equivilants. They have the same signature, same return values and throw the same errors. Each function is unit tested to ensure accuracy.
PHP_Compat is designed for ease of use. It has no dependencies and can be used completely outside the PEAR infrastructure.
An anti-pattern (or antipattern) is a pattern that may be commonly used but is ineffective and/or counterproductive in practice
Many anti-pattern ideas amount to little more than mistakes, rants, unsolvable problems, or bad practices to be avoided if possible. Sometimes called pitfalls or dark patterns, this informal use of the term has come to refer to classes of commonly reinvented bad solutions to problems.
phpcs /var/www/test/xml
FILE: /var/www/test/xml/index.php
——————————————————————————–
FOUND 2 ERROR(S) AFFECTING 2 LINE(S)
——————————————————————————–
1 | ERROR | End of line character is invalid; expected “n” but found “rn”
2 | ERROR | Missing file doc comment
——————————————————————————–
FILE: /var/www/test/xml/xml.php
——————————————————————————–
FOUND 8 ERROR(S) AND 1 WARNING(S) AFFECTING 8 LINE(S)
——————————————————————————–
1 | ERROR | End of line character is invalid; expected “n” but found
| | “rn”
2 | ERROR | Missing file doc comment
13 | ERROR | Expected “foreach (…) {n”; found “foreach(…)n{n”
15 | ERROR | Line indented incorrectly; expected at least 4 spaces, found 3
16 | ERROR | Line indented incorrectly; expected at least 4 spaces, found 3
18 | ERROR | Line indented incorrectly; expected 4 spaces, found 3
19 | ERROR | Line indented incorrectly; expected at least 8 spaces, found 4
19 | WARNING | Line exceeds 85 characters; contains 92 characters
21 | ERROR | Line indented incorrectly; expected at least 4 spaces, found 3
——————————————————————————–
phpcs test.php
FILE: /var/www/test/test.php
——————————————————————————–
FOUND 2 ERROR(S) AFFECTING 2 LINE(S)
——————————————————————————–
1 | ERROR | End of line character is invalid; expected “n” but found “rn”
2 | ERROR | Missing file doc comment
——————————————————————————–
Run the below given command
sudo apt-get install php-pear