iron-io/iron_worker_php — Issue #3: Added argument parsing into the library
Author: treeder
Created: 2012-01-16 04:28:47+00:00
State: open

I see the workers have to do things like this to parse the arguments and load the payload:

```
function getArgs(){
global $argv;
$args = array('task_id' => null, 'dir' => null, 'payload' => array());
foreach($argv as $k => $v){
if (empty($argv[$k+1])) continue;
if ($v == '-id') $args['task_id'] = $argv[$k+1];
if ($v == '-d') $args['dir'] = $argv[$k+1];
if ($v == '-payload' && file_exists($argv[$k+1])){
$args['payload'] = json_decode(file_get_contents($argv[$k+1]));
}
}
return $args;
}

$args = getArgs();
```

Can we put that into the library somehow so the worker only calls an init() method or something to do all this?