OSDN Git Service

pass string to DocParser (makes it easier to unit test)
authorscribu <mail@scribu.net>
Thu, 1 Aug 2013 19:40:34 +0000 (22:40 +0300)
committerscribu <mail@scribu.net>
Thu, 1 Aug 2013 19:40:34 +0000 (22:40 +0300)
php/WP_CLI/Dispatcher/CommandFactory.php
php/WP_CLI/DocParser.php

index 72eb104..4e7a0aa 100644 (file)
@@ -21,7 +21,7 @@ class CommandFactory {
        }
 
        private static function create_subcommand( $parent, $name, $class_name, $method ) {
-               $docparser = new \WP_CLI\DocParser( $method );
+               $docparser = new \WP_CLI\DocParser( $method->getDocComment() );
 
                if ( !$name )
                        $name = $docparser->get_tag( 'subcommand' );
@@ -39,7 +39,7 @@ class CommandFactory {
        }
 
        private static function create_composite_command( $parent, $name, $reflection ) {
-               $docparser = new \WP_CLI\DocParser( $reflection );
+               $docparser = new \WP_CLI\DocParser( $reflection->getDocComment() );
 
                $container = new CompositeCommand( $parent, $name, $docparser );
 
index 4d597a6..c5bfb16 100644 (file)
@@ -6,8 +6,8 @@ class DocParser {
 
        protected $docComment;
 
-       function __construct( $reflection ) {
-               $this->docComment = $reflection->getDocComment();
+       function __construct( $docComment ) {
+               $this->docComment = $docComment;
        }
 
        function get_shortdesc() {