Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e73817e

Browse files
committed
Update README.md
1 parent 3b958d5 commit e73817e

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed

README.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,85 @@ Possible combinations:
6161
* `-nhello` *short parameter with argument, no space separed, return hello*
6262
* `--user` *long parameter without argument, return true*
6363
* `--user=Piotr` *long parameter with argument, equal sign separed, return Piotr*
64+
65+
To add support to parameters in application in method `configure`, we must set parameters of each parameter.
66+
67+
```php
68+
public function configure()
69+
{
70+
$this
71+
->addParameter('N', 'namespace')
72+
->addParameter('u', 'user');
73+
}
74+
```
75+
76+
This configuration allows us to many possibilities call our parameters.
77+
78+
This call:
79+
80+
$ php psf.php app:hello -N php/\shell/\output
81+
82+
is corresponding to:
83+
84+
$ php psf.php app:hello --namespace php/\shell/\output
85+
86+
In `main` method we get parameter like this:
87+
88+
$namespace = $this->getParameterValue('namespace');
89+
90+
this getter working on `-N` and `--namespace` parameter equally.
91+
92+
__Special case.__ If we call application like that:
93+
94+
$ php psf.php app:hello -N php/\shell/\output --namespace php/\formatter
95+
96+
The `getParameterValue` method will return `php/formatter`.
97+
98+
Styling output
99+
--------------
100+
101+
Styling output is done by user-defined tags - like XML. Style formetter will replace XML tag to correct defined ANSI code sequence.
102+
103+
To declare new XML tag and corresonding with him ANSI code you do:
104+
105+
```php
106+
$styleFormat = new StyleFormatter('gray', 'magenta', array('blink', 'underline'));
107+
$this->setFormatter('special', $styleFormat);
108+
```
109+
110+
This would you to allow `<special>` tag in you output messages:
111+
112+
```php
113+
$this->out("<special>Hello</special> orld <special>Today</special>!!!");
114+
```
115+
116+
You can use following color for text attributes:
117+
118+
* black
119+
* red
120+
* green
121+
* brown
122+
* blue
123+
* magenta
124+
* cyan
125+
* gray
126+
127+
For background color use:
128+
129+
* black
130+
* red
131+
* green
132+
* brown
133+
* blue
134+
* magenta
135+
* cyan
136+
* white
137+
138+
Also you can use following effects:
139+
140+
* defaults
141+
* bold
142+
* underline
143+
* blink
144+
* reverse
145+
* conceal

0 commit comments

Comments
 (0)