WP_CLI\DocParser::get_arg_or_param_args PHP Method

get_arg_or_param_args() private method

Get the args for an arg or param
private get_arg_or_param_args ( string $regex ) : array | null
$regex string Pattern to match against
return array | null Interpreted YAML document, or null.
    private function get_arg_or_param_args($regex)
    {
        $bits = explode(PHP_EOL, $this->docComment);
        $within_arg = $within_doc = false;
        $document = array();
        foreach ($bits as $bit) {
            if (preg_match($regex, $bit)) {
                $within_arg = true;
            }
            if ($within_arg && $within_doc && '---' === $bit) {
                $within_doc = false;
            }
            if ($within_arg && !$within_doc && '---' === $bit) {
                $within_doc = true;
            }
            if ($within_doc) {
                $document[] = $bit;
            }
            if ($within_arg && '' === $bit) {
                $within_arg = false;
                break;
            }
        }
        if ($document) {
            return Spyc::YAMLLoadString(implode(PHP_EOL, $document));
        }
        return null;
    }