Use separated function to resolve command and related arguments

Hi,

This PR split command and related arguments resolution into two distinct functions.

It will help to solve the HHVM issue sensiolabs/SensioDistributionBundle#150 .

Thanks,

Jérémy

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | yes
| BC breaks?    | yes
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | ~
| License       | MIT
| Doc PR        | ~

This should return an array of arguments so that we can easily escape them.