lib/AdobeMarketingCloud/OptionParser.php
public function getUsage($maxWidth=80)
    {
        $head = wordwrap(implode('', $this->_head), $maxWidth);
        $tail = wordwrap(implode('', $this->_tail), $maxWidth);

        # determine if there are any short flags
        $hasShortFlag = false;
        $allFlags = array_keys($this->_flags);
        foreach ($allFlags as $flag) {
            if (strlen($flag) == 1) {
                $hasShortFlag = true;
                break;
            }
        }

        $maxFlagsWidth = 0;
        $flagDescriptions = array();
        foreach ($this->_rules as $ruleIndex => $rule) {
            $flagList = array_keys($this->_flags, $ruleIndex);
            if (empty($flagList)) {
                continue;
            }
            usort($flagList, array($this, 'compareFlags'));
            $flags = array();
            $short = false;
            foreach ($flagList as $flag) {
                if (strlen($flag) == 1) {
                    $flags[] = "-$flag";
                    $short = true;
                } else {
                    $flags[] = "--$flag";
                }
            }
            $flags = implode(', ', $flags);
            if ($hasShortFlag && !$short) {
                $flags = "    $flags";
            }
            $maxFlagsWidth = max(strlen($flags), $maxFlagsWidth);
            $flagDescriptions[$flags] = $rule['description'];
        }

        $options = array();
        $format = " %-{$maxFlagsWidth}s  ";
        foreach ($flagDescriptions as $flags => $description) {
            $wrap = wordwrap($description, $maxWidth - ($maxFlagsWidth + 3));
            $lines = explode("\n", $wrap);
            $option = array(sprintf($format, $flags) . array_shift($lines));
            foreach ($lines as $line) {
                $option[] = str_repeat(' ', $maxFlagsWidth + 3) . $line;
            }
            $options[] = implode("\n", $option);
        }

        $usage = $head . "\n" . implode("\n", $options) . "\n" . $tail;

        return $usage;
    }
public function getUsage($maxWidth=80)
    {
        $head = wordwrap(implode('', $this->_head), $maxWidth);
        $tail = wordwrap(implode('', $this->_tail), $maxWidth);

        # determine if there are any short flags
        $hasShortFlag = false;
        $allFlags = array_keys($this->_flags);
        foreach ($allFlags as $flag) {
            if (strlen($flag) == 1) {
                $hasShortFlag = true;
                break;
            }
        }

        $maxFlagsWidth = 0;
        $flagDescriptions = array();
        foreach ($this->_rules as $ruleIndex => $rule) {
            $flagList = array_keys($this->_flags, $ruleIndex);
            if (empty($flagList)) {
                continue;
            }
            usort($flagList, array($this, 'compareFlags'));
            $flags = array();
            $short = false;
            foreach ($flagList as $flag) {
                if (strlen($flag) == 1) {
                    $flags[] = "-$flag";
                    $short = true;
                } else {
                    $flags[] = "--$flag";
                }
            }
            $flags = implode(', ', $flags);
            if ($hasShortFlag && !$short) {
                $flags = "    $flags";
            }
            $maxFlagsWidth = max(strlen($flags), $maxFlagsWidth);
            $flagDescriptions[$flags] = $rule['description'];
        }

        $options = array();
        $format = " %-{$maxFlagsWidth}s  ";
        foreach ($flagDescriptions as $flags => $description) {
            $wrap = wordwrap($description, $maxWidth - ($maxFlagsWidth + 3));
            $lines = explode("\n", $wrap);
            $option = array(sprintf($format, $flags) . array_shift($lines));
            foreach ($lines as $line) {
                $option[] = str_repeat(' ', $maxFlagsWidth + 3) . $line;
            }
            $options[] = implode("\n", $option);
        }

        $usage = $head . "\n" . implode("\n", $options) . "\n" . $tail;

        return $usage;
    }
Gets a usage message for this parser. The optional $maxWidth parameter can be
used to specify with width at which the message should wrap.

@param   int
@return  string