Skip to content

Commit f920df0

Browse files
committed
fix readme.
Utopia\Validator\Email does not exist, changed to wildcard validator. Validator is an Object not a String.
1 parent 6d164b7 commit f920df0

2 files changed

Lines changed: 7 additions & 9 deletions

File tree

README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,17 @@ composer require utopia-php/cli
1818
script.php
1919
```php
2020
<?php
21-
2221
require_once './vendor/autoload.php';
2322

2423
use Utopia\CLI\CLI;
2524
use Utopia\CLI\Console;
26-
use Utopia\Validator\Email;
25+
use Utopia\Validator\Wildcard;
2726

2827
$cli = new CLI();
2928

3029
$cli
3130
->task('command-name')
32-
->param('email', null, new Email())
31+
->param('email', null, new Wildcard())
3332
->action(function ($email) {
3433
Console::success($email);
3534
});
@@ -70,8 +69,6 @@ Console::error('Red log message'); // stderr
7069

7170
Function returns exit code (0 - OK, >0 - error) and writes stdout, stderr to reference variables. The timeout variable allows you to limit the number of seconds the command can run.
7271

73-
74-
7572
```php
7673
$stdout = '';
7774
$stderr = '';
@@ -109,7 +106,7 @@ include './vendor/autoload.php';
109106

110107
Console::loop(function() {
111108
echo "Hello World\n";
112-
}, 200000 /* 200ms */);
109+
}, 1 /* 1 second */);
113110
```
114111

115112
## System Requirements

src/CLI/Task.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<?php
2-
32
namespace Utopia\CLI;
43

4+
use Utopia\Validator;
5+
56
class Task
67
{
78
/**
@@ -80,13 +81,13 @@ public function action(callable $action): self
8081
*
8182
* @param string $key
8283
* @param mixed $default
83-
* @param string $validator
84+
* @param Validator $validator
8485
* @param string $description
8586
* @param bool $optional
8687
*
8788
* @return $this
8889
*/
89-
public function param(string $key, $default, $validator, string $description = '', bool $optional = false): self
90+
public function param(string $key, $default, Validator $validator, string $description = '', bool $optional = false): self
9091
{
9192
$this->params[$key] = array(
9293
'default' => $default,

0 commit comments

Comments
 (0)