Example #1
0
 /**
  * Prints all available log options and returns the length of the longest
  * option.
  *
  * @return integer
  */
 protected function printLogOptions()
 {
     $maxLength = 0;
     $options = array();
     $logOptions = $this->application->getAvailableLoggerOptions();
     foreach ($logOptions as $option => $info) {
         // Build log option identifier
         $identifier = sprintf('%s=<%s>', $option, $info['value']);
         // Store in options array
         $options[$identifier] = $info['message'];
         $length = strlen($identifier);
         if ($length > $maxLength) {
             $maxLength = $length;
         }
     }
     ksort($options);
     $last = null;
     foreach ($options as $option => $message) {
         $current = substr($option, 0, strrpos($option, '-'));
         if ($last !== null && $last !== $current) {
             echo PHP_EOL;
         }
         $last = $current;
         $this->printOption($option, $message, $maxLength);
     }
     echo PHP_EOL;
     return $maxLength;
 }