diff --git a/library/Guzzle/Common/Inspector.php b/library/Guzzle/Common/Inspector.php index 8ff73b8c..a0a286f6 100644 --- a/library/Guzzle/Common/Inspector.php +++ b/library/Guzzle/Common/Inspector.php @@ -148,20 +148,13 @@ class Inspector * * @param string $doc DocBlock to parse * - * @return array Returns an array containing the description of the - * docblock in the 'doc' key and an array of args in the 'args' key. + * @return array Returns an associative array of the parsed docblock params */ public function parseDocBlock($doc) { - $description = ''; $params = array(); $matches = array(); - // Try to parse out the first line of the description of the command - if (preg_match('/^.*\*\s*(.+)/', $doc, $matches)) { - $description = trim(str_replace('*', '', $matches[1])); - } - // Get all of the @guzzle annotations from the class preg_match_all('/' . self::GUZZLE_ANNOTATION . '\s+([A-Za-z0-9_\-\.]+)\s*([A-Za-z0-9]+=".+")*/', $doc, $matches); @@ -187,10 +180,7 @@ class Inspector } } - return array( - 'doc' => $description, - 'args' => $params - ); + return $params; } /** @@ -208,10 +198,10 @@ class Inspector { if (!isset($this->cache[$className])) { $reflection = new \ReflectionClass($className); - $this->cache[$className] = $this->parseDocBlock($reflection); + $this->cache[$className] = $this->parseDocBlock($reflection->getDocComment()); } - return $this->validateConfig($this->cache[$className]['args'], $config, $strict); + return $this->validateConfig($this->cache[$className], $config, $strict); } /** diff --git a/tests/Guzzle/Tests/Common/InspectorTest.php b/tests/Guzzle/Tests/Common/InspectorTest.php index 27ec1acf..a83c02d6 100644 --- a/tests/Guzzle/Tests/Common/InspectorTest.php +++ b/tests/Guzzle/Tests/Common/InspectorTest.php @@ -43,8 +43,7 @@ class InspectorTest extends \Guzzle\Tests\GuzzleTestCase implements FilterInterf */ public function testValidatesRequiredArgs() { - $col = new Collection(); - Inspector::getInstance()->validateClass(__CLASS__, $col); + Inspector::getInstance()->validateClass(__CLASS__, new Collection()); } /** @@ -145,10 +144,6 @@ EOT; $params = Inspector::getInstance()->parseDocBlock($doc); - $this->assertEquals('Client for interacting with the Unfuddle webservice', $params['doc']); - - $params = $params['args']; - $this->assertEquals(array( 'required' => 'true', 'doc' => 'API username',