Yaffs site version 1.1
[yaffs-website] / vendor / phpdocumentor / reflection-docblock / README.md
1 The ReflectionDocBlock Component [![Build Status](https://secure.travis-ci.org/phpDocumentor/ReflectionDocBlock.png)](https://travis-ci.org/phpDocumentor/ReflectionDocBlock)
2 ================================
3
4 Introduction
5 ------------
6
7 The ReflectionDocBlock component of phpDocumentor provides a DocBlock parser
8 that is 100% compatible with the [PHPDoc standard](http://phpdoc.org/docs/latest).
9
10 With this component, a library can provide support for annotations via DocBlocks
11 or otherwise retrieve information that is embedded in a DocBlock.
12
13 > **Note**: *this is a core component of phpDocumentor and is constantly being
14 > optimized for performance.*
15
16 Installation
17 ------------
18
19 You can install the component in the following ways:
20
21 * Use the official Github repository (https://github.com/phpDocumentor/ReflectionDocBlock)
22 * Via Composer (http://packagist.org/packages/phpdocumentor/reflection-docblock)
23
24 Usage
25 -----
26
27 The ReflectionDocBlock component is designed to work in an identical fashion to
28 PHP's own Reflection extension (http://php.net/manual/en/book.reflection.php).
29
30 Parsing can be initiated by instantiating the
31 `\phpDocumentor\Reflection\DocBlock()` class and passing it a string containing
32 a DocBlock (including asterisks) or by passing an object supporting the
33 `getDocComment()` method.
34
35 > *Examples of objects having the `getDocComment()` method are the
36 > `ReflectionClass` and the `ReflectionMethod` classes of the PHP
37 > Reflection extension*
38
39 Example:
40
41     $class = new ReflectionClass('MyClass');
42     $phpdoc = new \phpDocumentor\Reflection\DocBlock($class);
43
44 or
45
46     $docblock = <<<DOCBLOCK
47     /**
48      * This is a short description.
49      *
50      * This is a *long* description.
51      *
52      * @return void
53      */
54     DOCBLOCK;
55
56     $phpdoc = new \phpDocumentor\Reflection\DocBlock($docblock);
57