@@ -40,9 +40,8 @@ protected function configure()
4040 */
4141 protected function execute (InputInterface $ input , OutputInterface $ output )
4242 {
43- $ header = <<<'EOF'
44- PHP Coding Standards Fixer
45- ==========================
43+ $ header = <<<EOF
44+ {$ this ->header ('PHP Coding Standards Fixer ' , '= ' )}
4645
4746The PHP Coding Standards Fixer (PHP CS Fixer) tool fixes your code to follow standards;
4847whether you want to follow PHP coding standards as defined in the PSR-1, PSR-2, etc.,
@@ -62,21 +61,17 @@ protected function execute(InputInterface $input, OutputInterface $output)
6261You can talk to us at https://gitter.im/PHP-CS-Fixer/Lobby about the project,
6362configuration, possible improvements, ideas and questions, please visit us!
6463
65- Requirements
66- ------------
64+ {$ this ->header ('Requirements ' , '- ' )}
6765
6866PHP needs to be a minimum version of PHP 5.6.0.
6967
70- Installation
71- ------------
68+ {$ this ->header ('Installation ' , '- ' )}
7269
73- Locally
74- ~~~~~~~
70+ {$ this ->header ('Locally ' , '~ ' )}
7571
7672Download the `php-cs-fixer.phar`_ file and store it somewhere on your computer.
7773
78- Globally (manual)
79- ~~~~~~~~~~~~~~~~~
74+ {$ this ->header ('Globally (manual) ' , '~ ' )}
8075
8176You can run these commands to easily access latest ``php-cs-fixer`` from anywhere on
8277your system:
@@ -106,8 +101,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
106101
107102Then, just run ``php-cs-fixer``.
108103
109- Globally (Composer)
110- ~~~~~~~~~~~~~~~~~~~
104+ {$ this ->header ('Globally (Composer) ' , '~ ' )}
111105
112106To install PHP CS Fixer, `install Composer <https://getcomposer.org/download/>`_ and issue the following command:
113107
@@ -119,79 +113,69 @@ protected function execute(InputInterface $input, OutputInterface $output)
119113
120114.. code-block:: bash
121115
122- $ export PATH="$PATH:$HOME/.composer/vendor/bin"
116+ $ export PATH=" \ $PATH: \ $HOME/.composer/vendor/bin"
123117
124- Globally (homebrew)
125- ~~~~~~~~~~~~~~~~~~~
118+ {$ this ->header ('Globally (homebrew) ' , '~ ' )}
126119
127120.. code-block:: bash
128121
129122 $ brew install php-cs-fixer
130123
131- Locally (PHIVE)
132- ~~~~~~~~~~~~~~~
124+ {$ this ->header ('Locally (PHIVE) ' , '~ ' )}
133125
134126Install `PHIVE <https://phar.io>`_ and issue the following command:
135127
136128.. code-block:: bash
137129
138130 $ phive install php-cs-fixer # use `--global` for global install
139131
140- Update
141- ------
132+ {$ this ->header ('Update ' , '- ' )}
142133
143- Locally
144- ~~~~~~~
134+ {$ this ->header ('Locally ' , '~ ' )}
145135
146136The ``self-update`` command tries to update ``php-cs-fixer`` itself:
147137
148138.. code-block:: bash
149139
150140 $ php php-cs-fixer.phar self-update
151141
152- Globally (manual)
153- ~~~~~~~~~~~~~~~~~
142+ {$ this ->header ('Globally (manual) ' , '~ ' )}
154143
155144You can update ``php-cs-fixer`` through this command:
156145
157146.. code-block:: bash
158147
159148 $ sudo php-cs-fixer self-update
160149
161- Globally (Composer)
162- ~~~~~~~~~~~~~~~~~~~
150+ {$ this ->header ('Globally (Composer) ' , '~ ' )}
163151
164152You can update ``php-cs-fixer`` through this command:
165153
166154.. code-block:: bash
167155
168156 $ ./composer.phar global update friendsofphp/php-cs-fixer
169157
170- Globally (homebrew)
171- ~~~~~~~~~~~~~~~~~~~
158+ {$ this ->header ('Globally (homebrew) ' , '~ ' )}
172159
173160You can update ``php-cs-fixer`` through this command:
174161
175162.. code-block:: bash
176163
177164 $ brew upgrade php-cs-fixer
178165
179- Locally (PHIVE)
180- ~~~~~~~~~~~~~~~~~~~
166+ {$ this ->header ('Locally (PHIVE) ' , '~ ' )}
181167
182168.. code-block:: bash
183169
184170 $ phive update php-cs-fixer
185171
186- Usage
187- -----
172+ {$ this ->header ('Usage ' , '- ' )}
188173
189174EOF ;
190175
191- $ footer = <<<' EOF'
176+ $ footer = <<<EOF
192177
193- Helpers
194- -------
178+ {$ this ->header ('Helpers ' , '- ' )}
195179
196180Dedicated plugins exist for:
197181
@@ -202,20 +186,17 @@ protected function execute(InputInterface $input, OutputInterface $output)
202186* `Vim`_
203187* `VS Code`_
204188
205- Contribute
206- ----------
189+ {$ this ->header ('Contribute ' , '- ' )}
207190
208191The tool comes with quite a few built-in fixers, but everyone is more than
209192welcome to `contribute`_ more of them.
210193
211- Fixers
212- ~~~~~~
194+ {$ this ->header ('Fixers ' , '~ ' )}
213195
214196A *fixer* is a class that tries to fix one CS issue (a ``Fixer`` class must
215197implement ``FixerInterface``).
216198
217- Configs
218- ~~~~~~~
199+ {$ this ->header ('Configs ' , '~ ' )}
219200
220201A *config* knows about the CS rules and the files and directories that must be
221202scanned by the tool when run in the directory of your project. It is useful for
@@ -290,4 +271,9 @@ static function (array $matches) {
290271
291272 return 0 ;
292273 }
274+
275+ private function header ($ name , $ underline )
276+ {
277+ return $ name ."\n" .str_repeat ($ underline , \strlen ($ name ));
278+ }
293279}
0 commit comments