https://github.com/devtronic/php-annotation-lexer
https://github.com/devtronic/php-annotation-lexer
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/devtronic/php-annotation-lexer
- Owner: devtronic
- License: mit
- Created: 2016-06-30T18:38:32.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-07-01T04:48:05.000Z (almost 10 years ago)
- Last Synced: 2024-12-30T21:29:12.561Z (over 1 year ago)
- Language: PHP
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PHP Annotation Lexer
PHP Annotation Lexer can extract the annotations (a.k.a. PHP Doc) from you sour cecode
### Example
```php
lexFromString($data);
print_r($res);
// Lex a file
$res = $lexer->lexFromFile('./vendor/devtronic/php-annotation-lexer/PHPAnnotationLexer.php');
print_r($res);
```
#### Output
```
Array
(
[0] => Array
(
[@ANNOTATION\DESC] => FooBar
[@ANNOTATION\PARAMETERS] => Array
(
[0] => Array
(
[@name] => baz
[@attr] => Array
(
[type] => string
[required] => true
)
)
)
[@return] => array The Parsed Attributes
)
)
Array
(
[0] => Array
(
[Class] => PHPAnnotationLexer
[@package] => Devtronic\PHPAnnotationLexer
)
[1] => Array
(
[@var] => string PHP Source Code To Lex
)
[2] => Array
(
[@param] => string $sourceFile The Path To The Source File
[@return] => array|bool If The File Exists The Lexed Source, Otherwise False
)
[3] => Array
(
[@param] => string $source PHP Source To Lex
[@return] => array The Lexed Source
)
[4] => Array
(
[@Foo\Bar)] => Array
(
[0] => Array
(
[@name] => And The Content
[@attr] => Array
(
)
)
[1] => And Put It Together
)
[@return] => array The Result Of Stage One
)
[5] => Array
(
[@param] => array $result The Result From Stage One
[@return] => array The Result Of Stage Two
)
[6] => Array
(
[@param] => string $str The Content From Stage One
[@return] => array|mixed The Parsed Content
)
[7] => Array
(
[@param] => string $attr_str The Un-Parsed Attribute String
[@return] => array The Parsed Attributes
)
)
```