src/OptionCollection.php
public function add()
    {
        $num = func_num_args();
        $args = func_get_args();
        $first = $args[0];

        if ($first instanceof Option) {

            $this->addOption($first);

        } else if (is_string($first)) {

            $specString = $args[0];
            $desc = isset($args[1]) ? $args[1] : null;
            $key = isset($args[2]) ? $args[2] : null;

            // parse spec string
            $spec = new Option($specString);
            if ($desc) {
                $spec->desc($desc);
            }
            if ($key) {
                $spec->key = $key;
            }
            $this->addOption($spec);
            return $spec;

        } else {

            throw new LogicException('Unknown Spec Type');

        }
    }
public function add()
    {
        $num = func_num_args();
        $args = func_get_args();
        $first = $args[0];

        if ($first instanceof Option) {

            $this->addOption($first);

        } else if (is_string($first)) {

            $specString = $args[0];
            $desc = isset($args[1]) ? $args[1] : null;
            $key = isset($args[2]) ? $args[2] : null;

            // parse spec string
            $spec = new Option($specString);
            if ($desc) {
                $spec->desc($desc);
            }
            if ($key) {
                $spec->key = $key;
            }
            $this->addOption($spec);
            return $spec;

        } else {

            throw new LogicException('Unknown Spec Type');

        }
    }
add( [spec string], [desc string] ).

add( [option object] )