More JSDoc cleanup. [closes #334]

Former-commit-id: dcb55079320e3bcd35c3bf4f36d18f393f16e426
This commit is contained in:
John-David Dalton
2013-08-26 22:01:44 -07:00
parent e322f6dbe2
commit c3f5bc6bfb
23 changed files with 1659 additions and 1631 deletions

View File

@@ -20,7 +20,7 @@ class Alias {
*
* @constructor
* @param {string} $name The alias name.
* @param {object} $owner The alias owner.
* @param {Object} $owner The alias owner.
*/
public function __construct( $name, $owner ) {
$this->owner = $owner;
@@ -48,7 +48,7 @@ class Alias {
*
* @memberOf Alias
* @param {number} $index The index of the array value to return.
* @returns {(array|string)} The entry's `alias` objects.
* @returns {Array|string} The entry's `alias` objects.
*/
public function getAliases( $index = null ) {
$result = array();
@@ -172,7 +172,7 @@ class Alias {
*
* @memberOf Alias
* @param {number} $index The index of the array value to return.
* @returns {(array|string)} The owner entry's `member` data.
* @returns {Array|string} The owner entry's `member` data.
*/
public function getMembers( $index = null ) {
return $index !== null
@@ -195,7 +195,7 @@ class Alias {
*
* @memberOf Alias
* @param {number} $index The index of the array value to return.
* @returns {array} The owner entry's `param` data.
* @returns {Array} The owner entry's `param` data.
*/
public function getParams( $index = null ) {
return $index !== null

View File

@@ -55,7 +55,7 @@ class Entry {
* @static
* @memberOf Entry
* @param {string} $source The source code.
* @returns {array} The array of entries.
* @returns {Array} The array of entries.
*/
public static function getEntries( $source ) {
preg_match_all('#/\*\*(?![-!])[\s\S]*?\*/\s*.+#', $source, $result);
@@ -90,7 +90,7 @@ class Entry {
*
* @memberOf Entry
* @param {number} $index The index of the array value to return.
* @returns {(array|string)} The entry's `alias` objects.
* @returns {Array|string} The entry's `alias` objects.
*/
public function getAliases( $index = null ) {
if (!isset($this->_aliases)) {
@@ -167,7 +167,7 @@ class Entry {
if (count($result)) {
$result = trim(preg_replace('/(?:^|\n)[\t ]*\*[\t ]?/', ' ', $result[1]));
} else {
$result = $this->getType() == 'function' ? 'Methods' : 'Properties';
$result = $this->getType() == 'Function' ? 'Methods' : 'Properties';
}
$this->_category = $result;
return $result;
@@ -191,7 +191,7 @@ class Entry {
$result = preg_replace('/(?:^|\n)[\t ]*\*\n[\t ]*\*[\t ]*/', "\n\n", $result);
$result = preg_replace('/(?:^|\n)[\t ]*\*[\t ]?/', ' ', $result);
$result = trim($result);
$result = ($type == 'function' ? '' : '(' . str_replace('|', ', ', trim($type, '{}')) . '): ') . $result;
$result = ($type == 'Function' ? '' : '(' . str_replace('|', ', ', trim($type, '{}')) . '): ') . $result;
}
$this->_desc = $result;
return $result;
@@ -330,7 +330,7 @@ class Entry {
*
* @memberOf Entry
* @param {number} $index The index of the array value to return.
* @returns {(array|string)} The entry's `member` data.
* @returns {Array|string} The entry's `member` data.
*/
public function getMembers( $index = null ) {
if (!isset($this->_members)) {
@@ -373,7 +373,7 @@ class Entry {
*
* @memberOf Entry
* @param {number} $index The index of the array value to return.
* @returns {array} The entry's `param` data.
* @returns {Array} The entry's `param` data.
*/
public function getParams( $index = null ) {
if (!isset($this->_params)) {
@@ -434,9 +434,12 @@ class Entry {
preg_match('#\*[\t ]*@type\s(?:\{\(?)?([^)}\n]+)#', $this->entry, $result);
if (count($result)) {
$result = trim(strtolower($result[1]));
$result = trim($result[1]);
if (preg_match('/^(?:array|function|object|regexp)$/', $result)) {
$result = ucfirst($result);
}
} else {
$result = $this->isFunction() ? 'function' : 'unknown';
$result = $this->isFunction() ? 'Function' : 'unknown';
}
$this->_type = $result;
return $result;

View File

@@ -56,7 +56,7 @@ class MarkdownGenerator {
*
* @constructor
* @param {string} $source The source code to parse.
* @param {array} $options The options array.
* @param {Array} $options The options array.
*/
public function __construct( $source, $options = array() ) {
// juggle arguments
@@ -139,7 +139,7 @@ class MarkdownGenerator {
* @static
* @memberOf MarkdownGenerator
* @param {string} $string The string to modify.
* @param {(array|object)} $object The template object.
* @param {Array|Object} $object The template object.
* @returns {string} The modified string.
*/
private static function interpolate( $string, $object ) {
@@ -175,8 +175,8 @@ class MarkdownGenerator {
*
* @private
* @memberOf MarkdownGenerator
* @param {array} $result The result array to modify.
* @param {array} $entries The entries to add to the `$result`.
* @param {Array} $result The result array to modify.
* @param {Array} $entries The entries to add to the `$result`.
*/
private function addEntries( &$result, $entries ) {
foreach ($entries as $entry) {
@@ -235,7 +235,7 @@ class MarkdownGenerator {
*
* @private
* @memberOf MarkdownGenerator
* @param {(number|object)} $entry The entry object.
* @param {number|Object} $entry The entry object.
* @param {string} $member The name of the member.
* @returns {string} The url hash.
*/
@@ -255,7 +255,7 @@ class MarkdownGenerator {
*
* @private
* @memberOf MarkdownGenerator
* @param {(number|object)} $entry The entry object.
* @param {number|Object} $entry The entry object.
* @returns {string} The url.
*/
private function getLineUrl( $entry ) {
@@ -268,7 +268,7 @@ class MarkdownGenerator {
*
* @private
* @memberOf MarkdownGenerator
* @param {(number|object)} $entry The entry object.
* @param {number|Object} $entry The entry object.
* @returns {string} The separator.
*/
private function getSeparator( $entry ) {
@@ -315,7 +315,7 @@ class MarkdownGenerator {
}
// append entry to api member
if (!$member || $entry->isCtor() || ($entry->getType() == 'object' &&
if (!$member || $entry->isCtor() || ($entry->getType() == 'Object' &&
!preg_match('/[=:]\s*(?:null|undefined)\s*[,;]?$/', $entry->entry))) {
// assign the real entry, replacing the temporary entry if it exist
@@ -400,7 +400,7 @@ class MarkdownGenerator {
foreach ($entry->{$kind} as $subentry) {
$name = $subentry->getName();
// functions w/o ALL-CAPs names are last
$sortBy['a'][] = $subentry->getType() == 'function' && !preg_match('/^[A-Z_]+$/', $name);
$sortBy['a'][] = $subentry->getType() == 'Function' && !preg_match('/^[A-Z_]+$/', $name);
// ALL-CAPs properties first
$sortBy['b'][] = preg_match('/^[A-Z_]+$/', $name);
// lowercase alphanumeric sort
@@ -541,7 +541,7 @@ class MarkdownGenerator {
$subentries = is_string($kind) ? $entry->{$kind} : array($kind);
// add sub-entry name
if ($kind != 'static' && $entry->getType() != 'object' &&
if ($kind != 'static' && $entry->getType() != 'Object' &&
count($subentries) && $subentries[0] != $kind) {
if ($kind == 'plugin') {
$result[] = $closeTag;