2017-25 © Pedro Peláez
 

library blox

A parser for block comment documentation.

image

eloquent/blox

A parser for block comment documentation.

  • Wednesday, January 29, 2014
  • by ezzatron
  • Repository
  • 1 Watchers
  • 6 Stars
  • 40,716 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 9 Versions
  • 2 % Grown

The README.md

Blox

A parser for block comment documentation., (*1)

![The most recent stable version is 3.0.1] ![Current build status image] ![Current coverage status image], (*2)

Installation and documentation

What is Blox?

Blox is a parser for PHP block comment documentation. Blox allows a standard documentation block comment to be parsed into an object tree representation, with a simple interface for retrieving information., (*3)

Usage

use Eloquent\Blox\BloxParser;

$blockComment = <<<'EOD'
/**
 * This is the summary.
 *     This is also the summary.
 *
 * This is the body.
 *
 * This is also the body.
 *
 * @tagA This is some tag content.
 * @tagA This is some more tag content.
 * @tagB This is content for a different tag
 *     which spans multiple lines.
 *
 * This is ignored.
 */
EOD;

$parser = new BloxParser;
$block = $parser->parseBlockComment($blockComment);

echo $block->summary(); // outputs 'This is the summary. This is also the summary.'
echo $block->body();    // outputs "This is the body.\n\nThis is also the body."

// outputs 'This is some tag content.', then 'This is some more tag content.'
foreach ($block->tagsByName('tagA') as $tag) {
    echo $tag->content();
}

$splatTags = $block->tagsByName('tagB');
echo array_pop($splatTags)->content(); // outputs 'This is content for a different tag which spans multiple lines.'

Conventions

Blox has a small set of conventions for block comments. They aim to be quite loose, so that Blox can be used, regardless of the body text format in use., (*4)

Summary text

The summary text starts from the first non-blank line and continues until a blank line, or the end of the block is encountered. White space at the beginning of lines, and newlines, are collapsed into a single space., (*5)

/**
 * This is the summary.
 *     This is also the summary.
 *
 * This is not the summary.
 */

Body text

The body text starts from the first non-blank line after the summary, and continues until a tag, or the end of the block is encountered. White space and newlines are left as-is., (*6)

/**
 * This is not the body.
 *
 * This is the body.
 *
 * This is also the body.
 *
 * @tagA This is not the body.
 */

Tags

A tag is any line starting with the 'at' symbol (@) followed by one or more 'word' characters (as defined in PCRE). These 'word' characters make up the tag's 'name'., (*7)

Tags can optionally be followed by content which will be associated with the tag. White space directly after the tag name is ignored, but subsequent text is included in the tag content, as are subsequent lines until a blank line or another tag is encountered. White space at the beginning of lines, and newlines, are collapsed into a single space., (*8)

/**
 * This is not a tag.
 *
 * @tagA This is some tag content.
 * @tagA This is some more tag content.
 * @tagB This is content for a different tag
 *     which spans multiple lines.
 *
 * This is ignored.
 */

The Versions

29/01 2014

dev-develop

dev-develop https://github.com/eloquent/blox

A parser for block comment documentation.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

parser documentation phpdoc phpdocumentor docblock block tag annotation comment

26/01 2014

dev-master

9999999-dev https://github.com/eloquent/blox

A parser for block comment documentation.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

parser documentation phpdoc phpdocumentor docblock block tag annotation comment

26/01 2014

3.0.1

3.0.1.0 https://github.com/eloquent/blox

A parser for block comment documentation.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

parser documentation phpdoc phpdocumentor docblock block tag annotation comment

01/08 2013

3.0.0

3.0.0.0 https://github.com/eloquent/blox

A parser for block comment documentation.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

parser documentation phpdoc phpdocumentor docblock block tag annotation comment

04/03 2013

2.0.0

2.0.0.0 https://github.com/eloquent/blox

A parser for block comment documentation.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

parser documentation phpdoc phpdocumentor docblock block tag annotation comment

05/08 2012

1.2.0

1.2.0.0 https://github.com/eloquent/blox

A parser for block comment documentation.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

parser documentation phpdoc phpdocumentor docblock block tag annotation comment

04/08 2012

1.1.1

1.1.1.0 https://github.com/eloquent/blox

A parser for block comment documentation.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

parser documentation phpdoc phpdocumentor docblock block tag annotation comment

04/08 2012

1.1.0

1.1.0.0 https://github.com/eloquent/blox

A parser for block comment documentation.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

parser documentation phpdoc phpdocumentor docblock block tag annotation comment

04/08 2012

1.0.0

1.0.0.0 https://github.com/eloquent/blox

A parser for block comment documentation.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

parser documentation phpdoc phpdocumentor docblock block tag annotation comment