OSDN Git Service

DocParser: implement get_longdesc()
authorscribu <mail@scribu.net>
Thu, 1 Aug 2013 20:48:38 +0000 (23:48 +0300)
committerscribu <mail@scribu.net>
Thu, 1 Aug 2013 20:48:38 +0000 (23:48 +0300)
php/WP_CLI/DocParser.php

index e146833..a999a9e 100644 (file)
@@ -26,7 +26,22 @@ class DocParser {
        }
 
        function get_longdesc() {
-               return false;
+               $shortdesc = $this->get_shortdesc();
+               if ( !$shortdesc )
+                       return '';
+
+               $longdesc = substr( $this->docComment, strlen( $shortdesc ) );
+
+               $lines = array();
+               foreach ( explode( "\n", $longdesc ) as $line ) {
+                       if ( 0 === strpos( $line, '@' ) )
+                               break;
+
+                       $lines[] = $line;
+               }
+               $longdesc = trim( implode( $lines, "\n" ) );
+
+               return $longdesc;
        }
 
        function get_tag( $name ) {