Skip to content

Commit 6f436b5

Browse files
committed
update readme
1 parent 94d8b69 commit 6f436b5

File tree

1 file changed

+22
-15
lines changed

1 file changed

+22
-15
lines changed

README.md

+22-15
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ $result = Balancer::run('task1');
4040

4141
# Method
4242

43-
1. Balancer::task($taskName, [$data, ] $work);
43+
###1. Balancer::task($taskName, [$data, ] $work);
4444

4545
create a task instance, return task instance.
4646

@@ -50,15 +50,17 @@ Balancer::task('taskName', $data, function($task){
5050
});
5151
```
5252

53-
2. Balancer::run($taskName)
53+
**note:** `$data` will store in task instance.
54+
55+
###2. Balancer::run($taskName)
5456

5557
run the task, return a results array.
5658

57-
3. $task->driver($optionString, [$weight, 'backup', ] $work);
59+
###3. $task->driver($optionString, [$weight, 'backup', ] $work);
5860

5961
create a driver instance for `$task`, return driver instance.
6062

61-
**note:**$weight must be a integer
63+
**note:** `$weight` must be a integer
6264

6365
```php
6466
$task->driver('driverName 80 backup', function($driver, $data){
@@ -67,45 +69,50 @@ $task->driver('driverName 80 backup', function($driver, $data){
6769
});
6870
```
6971

70-
4. $driver->weight($weight)
72+
###4. $driver->weight($weight)
7173

7274
set driver`s weight, return current driver,
7375
supported chain operation.
7476

75-
**note:**$weight must be a integer
77+
**note:** `$weight` must be a integer
7678

77-
5. $driver->backup($is)
79+
###5. $driver->backup($is)
7880

7981
set driver is backup, return current driver,
8082
supported chain operation.
8183

82-
**note:**$is must be true of false
84+
**note:** `$is` must be true of false
8385

84-
6. $driver->data($data);
86+
###6. $driver->data($data);
8587

8688
set data for driver`s work use,
8789
support chain operation.
8890

89-
7. $driver->work(function($driver, $data){});
91+
**note:** `$data` will store in driver instance.
92+
93+
###7. $driver->work(function($driver, $data){});
9094

91-
set driver`s work, give two arguments: $driver and $data,
95+
set driver`s work, give two arguments: `$driver` and `$data`,
9296
support chain operation.
9397

94-
8. $driver->failed()
98+
**note:** `$data` is try to get from driver instance,
99+
if null will continue try to get from task instance.
100+
101+
###8. $driver->failed()
95102

96103
set current driver run failed,
97104
support chain operation.
98105

99-
9. $driver->success()
106+
###9. $driver->success()
100107

101108
set current driver run successful.
102109
support chain operation.
103110

104-
10. $driver->getDriverData()
111+
###10. $driver->getDriverData()
105112

106113
get data from driver.
107114

108-
11. $driver->getTaskData()
115+
###11. $driver->getTaskData()
109116

110117
get data from task.
111118

0 commit comments

Comments
 (0)