update v 1.0.7.5
This commit is contained in:
4
vendor/phpdocumentor/reflection-common/.gitignore
vendored
Normal file
4
vendor/phpdocumentor/reflection-common/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
composer.phar
|
||||
vendor/
|
||||
build/
|
||||
|
22
vendor/phpdocumentor/reflection-common/LICENSE
vendored
Normal file
22
vendor/phpdocumentor/reflection-common/LICENSE
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 phpDocumentor
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
1
vendor/phpdocumentor/reflection-common/README.md
vendored
Normal file
1
vendor/phpdocumentor/reflection-common/README.md
vendored
Normal file
@@ -0,0 +1 @@
|
||||
# ReflectionCommon
|
29
vendor/phpdocumentor/reflection-common/composer.json
vendored
Normal file
29
vendor/phpdocumentor/reflection-common/composer.json
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "phpdocumentor/reflection-common",
|
||||
"keywords": ["phpdoc", "phpDocumentor", "reflection", "static analysis", "FQSEN"],
|
||||
"homepage": "http://www.phpdoc.org",
|
||||
"description": "Common reflection classes used by phpdocumentor to reflect the code structure",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jaap van Otterdijk",
|
||||
"email": "opensource@ijaap.nl"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.5"
|
||||
},
|
||||
"autoload" : {
|
||||
"psr-4" : {
|
||||
"phpDocumentor\\Reflection\\": ["src"]
|
||||
}
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^4.6"
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0.x-dev"
|
||||
}
|
||||
}
|
||||
}
|
974
vendor/phpdocumentor/reflection-common/composer.lock
generated
vendored
Normal file
974
vendor/phpdocumentor/reflection-common/composer.lock
generated
vendored
Normal file
@@ -0,0 +1,974 @@
|
||||
{
|
||||
"_readme": [
|
||||
"This file locks the dependencies of your project to a known state",
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"hash": "49ee00389e4ccd00d7e93a147103b2ab",
|
||||
"packages": [],
|
||||
"packages-dev": [
|
||||
{
|
||||
"name": "doctrine/instantiator",
|
||||
"version": "1.0.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/doctrine/instantiator.git",
|
||||
"reference": "f976e5de371104877ebc89bd8fecb0019ed9c119"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/f976e5de371104877ebc89bd8fecb0019ed9c119",
|
||||
"reference": "f976e5de371104877ebc89bd8fecb0019ed9c119",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3,<8.0-DEV"
|
||||
},
|
||||
"require-dev": {
|
||||
"athletic/athletic": "~0.1.8",
|
||||
"ext-pdo": "*",
|
||||
"ext-phar": "*",
|
||||
"phpunit/phpunit": "~4.0",
|
||||
"squizlabs/php_codesniffer": "2.0.*@ALPHA"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Doctrine\\Instantiator\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Marco Pivetta",
|
||||
"email": "ocramius@gmail.com",
|
||||
"homepage": "http://ocramius.github.com/"
|
||||
}
|
||||
],
|
||||
"description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
|
||||
"homepage": "https://github.com/doctrine/instantiator",
|
||||
"keywords": [
|
||||
"constructor",
|
||||
"instantiate"
|
||||
],
|
||||
"time": "2014-10-13 12:58:55"
|
||||
},
|
||||
{
|
||||
"name": "phpdocumentor/reflection-docblock",
|
||||
"version": "2.0.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
|
||||
"reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d68dbdc53dc358a816f00b300704702b2eaff7b8",
|
||||
"reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.0"
|
||||
},
|
||||
"suggest": {
|
||||
"dflydev/markdown": "~1.0",
|
||||
"erusev/parsedown": "~1.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"phpDocumentor": [
|
||||
"src/"
|
||||
]
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Mike van Riel",
|
||||
"email": "mike.vanriel@naenius.com"
|
||||
}
|
||||
],
|
||||
"time": "2015-02-03 12:10:50"
|
||||
},
|
||||
{
|
||||
"name": "phpspec/prophecy",
|
||||
"version": "v1.4.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpspec/prophecy.git",
|
||||
"reference": "3132b1f44c7bf2ec4c7eb2d3cb78fdeca760d373"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/3132b1f44c7bf2ec4c7eb2d3cb78fdeca760d373",
|
||||
"reference": "3132b1f44c7bf2ec4c7eb2d3cb78fdeca760d373",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"doctrine/instantiator": "^1.0.2",
|
||||
"phpdocumentor/reflection-docblock": "~2.0",
|
||||
"sebastian/comparator": "~1.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpspec/phpspec": "~2.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.4.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Prophecy\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Konstantin Kudryashov",
|
||||
"email": "ever.zet@gmail.com",
|
||||
"homepage": "http://everzet.com"
|
||||
},
|
||||
{
|
||||
"name": "Marcello Duarte",
|
||||
"email": "marcello.duarte@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "Highly opinionated mocking framework for PHP 5.3+",
|
||||
"homepage": "https://github.com/phpspec/prophecy",
|
||||
"keywords": [
|
||||
"Double",
|
||||
"Dummy",
|
||||
"fake",
|
||||
"mock",
|
||||
"spy",
|
||||
"stub"
|
||||
],
|
||||
"time": "2015-04-27 22:15:08"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-code-coverage",
|
||||
"version": "2.1.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
|
||||
"reference": "6b7d2094ca2a685a2cad846cb7cd7a30e8b9470f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/6b7d2094ca2a685a2cad846cb7cd7a30e8b9470f",
|
||||
"reference": "6b7d2094ca2a685a2cad846cb7cd7a30e8b9470f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3",
|
||||
"phpunit/php-file-iterator": "~1.3",
|
||||
"phpunit/php-text-template": "~1.2",
|
||||
"phpunit/php-token-stream": "~1.3",
|
||||
"sebastian/environment": "~1.0",
|
||||
"sebastian/version": "~1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-xdebug": ">=2.1.4",
|
||||
"phpunit/phpunit": "~4"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-dom": "*",
|
||||
"ext-xdebug": ">=2.2.1",
|
||||
"ext-xmlwriter": "*"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.1.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"src/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Sebastian Bergmann",
|
||||
"email": "sb@sebastian-bergmann.de",
|
||||
"role": "lead"
|
||||
}
|
||||
],
|
||||
"description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.",
|
||||
"homepage": "https://github.com/sebastianbergmann/php-code-coverage",
|
||||
"keywords": [
|
||||
"coverage",
|
||||
"testing",
|
||||
"xunit"
|
||||
],
|
||||
"time": "2015-06-01 07:35:26"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-file-iterator",
|
||||
"version": "1.4.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/php-file-iterator.git",
|
||||
"reference": "a923bb15680d0089e2316f7a4af8f437046e96bb"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/a923bb15680d0089e2316f7a4af8f437046e96bb",
|
||||
"reference": "a923bb15680d0089e2316f7a4af8f437046e96bb",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.4.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"src/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Sebastian Bergmann",
|
||||
"email": "sb@sebastian-bergmann.de",
|
||||
"role": "lead"
|
||||
}
|
||||
],
|
||||
"description": "FilterIterator implementation that filters files based on a list of suffixes.",
|
||||
"homepage": "https://github.com/sebastianbergmann/php-file-iterator/",
|
||||
"keywords": [
|
||||
"filesystem",
|
||||
"iterator"
|
||||
],
|
||||
"time": "2015-04-02 05:19:05"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-text-template",
|
||||
"version": "1.2.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/php-text-template.git",
|
||||
"reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/206dfefc0ffe9cebf65c413e3d0e809c82fbf00a",
|
||||
"reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"Text/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"include-path": [
|
||||
""
|
||||
],
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Sebastian Bergmann",
|
||||
"email": "sb@sebastian-bergmann.de",
|
||||
"role": "lead"
|
||||
}
|
||||
],
|
||||
"description": "Simple template engine.",
|
||||
"homepage": "https://github.com/sebastianbergmann/php-text-template/",
|
||||
"keywords": [
|
||||
"template"
|
||||
],
|
||||
"time": "2014-01-30 17:20:04"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-timer",
|
||||
"version": "1.0.5",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/php-timer.git",
|
||||
"reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/19689d4354b295ee3d8c54b4f42c3efb69cbc17c",
|
||||
"reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"PHP/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"include-path": [
|
||||
""
|
||||
],
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Sebastian Bergmann",
|
||||
"email": "sb@sebastian-bergmann.de",
|
||||
"role": "lead"
|
||||
}
|
||||
],
|
||||
"description": "Utility class for timing",
|
||||
"homepage": "https://github.com/sebastianbergmann/php-timer/",
|
||||
"keywords": [
|
||||
"timer"
|
||||
],
|
||||
"time": "2013-08-02 07:42:54"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-token-stream",
|
||||
"version": "1.4.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/php-token-stream.git",
|
||||
"reference": "eab81d02569310739373308137284e0158424330"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/eab81d02569310739373308137284e0158424330",
|
||||
"reference": "eab81d02569310739373308137284e0158424330",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-tokenizer": "*",
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.2"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.4-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"src/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Sebastian Bergmann",
|
||||
"email": "sebastian@phpunit.de"
|
||||
}
|
||||
],
|
||||
"description": "Wrapper around PHP's tokenizer extension.",
|
||||
"homepage": "https://github.com/sebastianbergmann/php-token-stream/",
|
||||
"keywords": [
|
||||
"tokenizer"
|
||||
],
|
||||
"time": "2015-04-08 04:46:07"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/phpunit",
|
||||
"version": "4.6.9",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||
"reference": "816d12536a7a032adc3b68737f82cfbbf98b79c1"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/816d12536a7a032adc3b68737f82cfbbf98b79c1",
|
||||
"reference": "816d12536a7a032adc3b68737f82cfbbf98b79c1",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-dom": "*",
|
||||
"ext-json": "*",
|
||||
"ext-pcre": "*",
|
||||
"ext-reflection": "*",
|
||||
"ext-spl": "*",
|
||||
"php": ">=5.3.3",
|
||||
"phpspec/prophecy": "~1.3,>=1.3.1",
|
||||
"phpunit/php-code-coverage": "~2.0,>=2.0.11",
|
||||
"phpunit/php-file-iterator": "~1.4",
|
||||
"phpunit/php-text-template": "~1.2",
|
||||
"phpunit/php-timer": "~1.0",
|
||||
"phpunit/phpunit-mock-objects": "~2.3",
|
||||
"sebastian/comparator": "~1.1",
|
||||
"sebastian/diff": "~1.2",
|
||||
"sebastian/environment": "~1.2",
|
||||
"sebastian/exporter": "~1.2",
|
||||
"sebastian/global-state": "~1.0",
|
||||
"sebastian/version": "~1.0",
|
||||
"symfony/yaml": "~2.1|~3.0"
|
||||
},
|
||||
"suggest": {
|
||||
"phpunit/php-invoker": "~1.1"
|
||||
},
|
||||
"bin": [
|
||||
"phpunit"
|
||||
],
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "4.6.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"src/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Sebastian Bergmann",
|
||||
"email": "sebastian@phpunit.de",
|
||||
"role": "lead"
|
||||
}
|
||||
],
|
||||
"description": "The PHP Unit Testing framework.",
|
||||
"homepage": "https://phpunit.de/",
|
||||
"keywords": [
|
||||
"phpunit",
|
||||
"testing",
|
||||
"xunit"
|
||||
],
|
||||
"time": "2015-05-29 06:00:03"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/phpunit-mock-objects",
|
||||
"version": "2.3.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
|
||||
"reference": "253c005852591fd547fc18cd5b7b43a1ec82d8f7"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/253c005852591fd547fc18cd5b7b43a1ec82d8f7",
|
||||
"reference": "253c005852591fd547fc18cd5b7b43a1ec82d8f7",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"doctrine/instantiator": "~1.0,>=1.0.2",
|
||||
"php": ">=5.3.3",
|
||||
"phpunit/php-text-template": "~1.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.4"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-soap": "*"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.3.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"src/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Sebastian Bergmann",
|
||||
"email": "sb@sebastian-bergmann.de",
|
||||
"role": "lead"
|
||||
}
|
||||
],
|
||||
"description": "Mock Object library for PHPUnit",
|
||||
"homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/",
|
||||
"keywords": [
|
||||
"mock",
|
||||
"xunit"
|
||||
],
|
||||
"time": "2015-05-29 05:19:18"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/comparator",
|
||||
"version": "1.1.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/comparator.git",
|
||||
"reference": "1dd8869519a225f7f2b9eb663e225298fade819e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1dd8869519a225f7f2b9eb663e225298fade819e",
|
||||
"reference": "1dd8869519a225f7f2b9eb663e225298fade819e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3",
|
||||
"sebastian/diff": "~1.2",
|
||||
"sebastian/exporter": "~1.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.4"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.1.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"src/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jeff Welch",
|
||||
"email": "whatthejeff@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Volker Dusch",
|
||||
"email": "github@wallbash.com"
|
||||
},
|
||||
{
|
||||
"name": "Bernhard Schussek",
|
||||
"email": "bschussek@2bepublished.at"
|
||||
},
|
||||
{
|
||||
"name": "Sebastian Bergmann",
|
||||
"email": "sebastian@phpunit.de"
|
||||
}
|
||||
],
|
||||
"description": "Provides the functionality to compare PHP values for equality",
|
||||
"homepage": "http://www.github.com/sebastianbergmann/comparator",
|
||||
"keywords": [
|
||||
"comparator",
|
||||
"compare",
|
||||
"equality"
|
||||
],
|
||||
"time": "2015-01-29 16:28:08"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/diff",
|
||||
"version": "1.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/diff.git",
|
||||
"reference": "863df9687835c62aa423a22412d26fa2ebde3fd3"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/863df9687835c62aa423a22412d26fa2ebde3fd3",
|
||||
"reference": "863df9687835c62aa423a22412d26fa2ebde3fd3",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.2"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.3-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"src/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Kore Nordmann",
|
||||
"email": "mail@kore-nordmann.de"
|
||||
},
|
||||
{
|
||||
"name": "Sebastian Bergmann",
|
||||
"email": "sebastian@phpunit.de"
|
||||
}
|
||||
],
|
||||
"description": "Diff implementation",
|
||||
"homepage": "http://www.github.com/sebastianbergmann/diff",
|
||||
"keywords": [
|
||||
"diff"
|
||||
],
|
||||
"time": "2015-02-22 15:13:53"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/environment",
|
||||
"version": "1.2.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/environment.git",
|
||||
"reference": "5a8c7d31914337b69923db26c4221b81ff5a196e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5a8c7d31914337b69923db26c4221b81ff5a196e",
|
||||
"reference": "5a8c7d31914337b69923db26c4221b81ff5a196e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.4"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.3.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"src/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Sebastian Bergmann",
|
||||
"email": "sebastian@phpunit.de"
|
||||
}
|
||||
],
|
||||
"description": "Provides functionality to handle HHVM/PHP environments",
|
||||
"homepage": "http://www.github.com/sebastianbergmann/environment",
|
||||
"keywords": [
|
||||
"Xdebug",
|
||||
"environment",
|
||||
"hhvm"
|
||||
],
|
||||
"time": "2015-01-01 10:01:08"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/exporter",
|
||||
"version": "1.2.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/exporter.git",
|
||||
"reference": "84839970d05254c73cde183a721c7af13aede943"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/84839970d05254c73cde183a721c7af13aede943",
|
||||
"reference": "84839970d05254c73cde183a721c7af13aede943",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3",
|
||||
"sebastian/recursion-context": "~1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.4"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.2.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"src/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jeff Welch",
|
||||
"email": "whatthejeff@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Volker Dusch",
|
||||
"email": "github@wallbash.com"
|
||||
},
|
||||
{
|
||||
"name": "Bernhard Schussek",
|
||||
"email": "bschussek@2bepublished.at"
|
||||
},
|
||||
{
|
||||
"name": "Sebastian Bergmann",
|
||||
"email": "sebastian@phpunit.de"
|
||||
},
|
||||
{
|
||||
"name": "Adam Harvey",
|
||||
"email": "aharvey@php.net"
|
||||
}
|
||||
],
|
||||
"description": "Provides the functionality to export PHP variables for visualization",
|
||||
"homepage": "http://www.github.com/sebastianbergmann/exporter",
|
||||
"keywords": [
|
||||
"export",
|
||||
"exporter"
|
||||
],
|
||||
"time": "2015-01-27 07:23:06"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/global-state",
|
||||
"version": "1.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/global-state.git",
|
||||
"reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/c7428acdb62ece0a45e6306f1ae85e1c05b09c01",
|
||||
"reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.2"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-uopz": "*"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"src/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Sebastian Bergmann",
|
||||
"email": "sebastian@phpunit.de"
|
||||
}
|
||||
],
|
||||
"description": "Snapshotting of global state",
|
||||
"homepage": "http://www.github.com/sebastianbergmann/global-state",
|
||||
"keywords": [
|
||||
"global state"
|
||||
],
|
||||
"time": "2014-10-06 09:23:50"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/recursion-context",
|
||||
"version": "1.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/recursion-context.git",
|
||||
"reference": "3989662bbb30a29d20d9faa04a846af79b276252"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/3989662bbb30a29d20d9faa04a846af79b276252",
|
||||
"reference": "3989662bbb30a29d20d9faa04a846af79b276252",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.4"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"src/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jeff Welch",
|
||||
"email": "whatthejeff@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Sebastian Bergmann",
|
||||
"email": "sebastian@phpunit.de"
|
||||
},
|
||||
{
|
||||
"name": "Adam Harvey",
|
||||
"email": "aharvey@php.net"
|
||||
}
|
||||
],
|
||||
"description": "Provides functionality to recursively process PHP variables",
|
||||
"homepage": "http://www.github.com/sebastianbergmann/recursion-context",
|
||||
"time": "2015-01-24 09:48:32"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/version",
|
||||
"version": "1.0.5",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/version.git",
|
||||
"reference": "ab931d46cd0d3204a91e1b9a40c4bc13032b58e4"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/version/zipball/ab931d46cd0d3204a91e1b9a40c4bc13032b58e4",
|
||||
"reference": "ab931d46cd0d3204a91e1b9a40c4bc13032b58e4",
|
||||
"shasum": ""
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"src/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Sebastian Bergmann",
|
||||
"email": "sebastian@phpunit.de",
|
||||
"role": "lead"
|
||||
}
|
||||
],
|
||||
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
|
||||
"homepage": "https://github.com/sebastianbergmann/version",
|
||||
"time": "2015-02-24 06:35:25"
|
||||
},
|
||||
{
|
||||
"name": "symfony/yaml",
|
||||
"version": "v2.7.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/Yaml.git",
|
||||
"reference": "4a29a5248aed4fb45f626a7bbbd330291492f5c3"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/Yaml/zipball/4a29a5248aed4fb45f626a7bbbd330291492f5c3",
|
||||
"reference": "4a29a5248aed4fb45f626a7bbbd330291492f5c3",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.9"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/phpunit-bridge": "~2.7"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.7-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\Yaml\\": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony Yaml Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2015-05-02 15:21:08"
|
||||
}
|
||||
],
|
||||
"aliases": [],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": [],
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": [],
|
||||
"platform-dev": []
|
||||
}
|
26
vendor/phpdocumentor/reflection-common/phpunit.xml.dist
vendored
Normal file
26
vendor/phpdocumentor/reflection-common/phpunit.xml.dist
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<phpunit bootstrap="tests/common/bootstrap.php" colors="true">
|
||||
<testsuites>
|
||||
<testsuite name="phpDocumentor">
|
||||
<directory>./tests/unit/</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<filter>
|
||||
<whitelist>
|
||||
<directory suffix=".php">src</directory>
|
||||
</whitelist>
|
||||
</filter>
|
||||
<logging>
|
||||
<log type="coverage-html"
|
||||
title="phpDocumentor Reflection Common"
|
||||
target="build/coverage"
|
||||
charset="UTF-8"
|
||||
yui="true"
|
||||
highlight="false"
|
||||
lowUpperBound="35"
|
||||
highLowerBound="70" />
|
||||
<log type="coverage-clover" target="build/logs/clover.xml"/>
|
||||
<log type="junit" target="build/logs/junit.xml" logIncompleteSkipped="false" />
|
||||
</logging>
|
||||
</phpunit>
|
32
vendor/phpdocumentor/reflection-common/src/Element.php
vendored
Normal file
32
vendor/phpdocumentor/reflection-common/src/Element.php
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor
|
||||
*
|
||||
* PHP Version 5.5
|
||||
*
|
||||
* @copyright 2010-2015 Mike van Riel / Naenius (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection;
|
||||
|
||||
/**
|
||||
* Interface for Api Elements
|
||||
*/
|
||||
interface Element
|
||||
{
|
||||
/**
|
||||
* Returns the Fqsen of the element.
|
||||
*
|
||||
* @return Fqsen
|
||||
*/
|
||||
public function getFqsen();
|
||||
|
||||
/**
|
||||
* Returns the name of the element.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName();
|
||||
}
|
40
vendor/phpdocumentor/reflection-common/src/File.php
vendored
Normal file
40
vendor/phpdocumentor/reflection-common/src/File.php
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of phpDocumentor.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection;
|
||||
|
||||
/**
|
||||
* Interface for files processed by the ProjectFactory
|
||||
*/
|
||||
interface File
|
||||
{
|
||||
/**
|
||||
* Returns the content of the file as a string.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getContents();
|
||||
|
||||
/**
|
||||
* Returns md5 hash of the file.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function md5();
|
||||
|
||||
/**
|
||||
* Returns an relative path to the file.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function path();
|
||||
}
|
78
vendor/phpdocumentor/reflection-common/src/Fqsen.php
vendored
Normal file
78
vendor/phpdocumentor/reflection-common/src/Fqsen.php
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor
|
||||
*
|
||||
* PHP Version 5.5
|
||||
*
|
||||
* @copyright 2010-2015 Mike van Riel / Naenius (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection;
|
||||
|
||||
/**
|
||||
* Value Object for Fqsen.
|
||||
*
|
||||
* @link https://github.com/phpDocumentor/fig-standards/blob/master/proposed/phpdoc-meta.md
|
||||
*/
|
||||
final class Fqsen
|
||||
{
|
||||
/**
|
||||
* @var string full quallified class name
|
||||
*/
|
||||
private $fqsen;
|
||||
|
||||
/**
|
||||
* @var string name of the element without path.
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* Initializes the object.
|
||||
*
|
||||
* @param string $fqsen
|
||||
*
|
||||
* @throws \InvalidArgumentException when $fqsen is not matching the format.
|
||||
*/
|
||||
public function __construct($fqsen)
|
||||
{
|
||||
$matches = array();
|
||||
$result = preg_match('/^\\\\([\\w_\\\\]*)(?:[:]{2}\\$?([\\w_]+))?(?:\\(\\))?$/', $fqsen, $matches);
|
||||
|
||||
if ($result === 0) {
|
||||
throw new \InvalidArgumentException(
|
||||
sprintf('"%s" is not a valid Fqsen.', $fqsen)
|
||||
);
|
||||
}
|
||||
|
||||
$this->fqsen = $fqsen;
|
||||
|
||||
if (isset($matches[2])) {
|
||||
$this->name = $matches[2];
|
||||
} else {
|
||||
$matches = explode('\\', $fqsen);
|
||||
$this->name = trim(end($matches), '()');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* converts this class to string.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->fqsen;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of the element without path.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
}
|
57
vendor/phpdocumentor/reflection-common/src/Location.php
vendored
Normal file
57
vendor/phpdocumentor/reflection-common/src/Location.php
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of phpDocumentor.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection;
|
||||
|
||||
/**
|
||||
* The location where an element occurs within a file.
|
||||
*/
|
||||
final class Location
|
||||
{
|
||||
/** @var int */
|
||||
private $lineNumber = 0;
|
||||
|
||||
/** @var int */
|
||||
private $columnNumber = 0;
|
||||
|
||||
/**
|
||||
* Initializes the location for an element using its line number in the file and optionally the column number.
|
||||
*
|
||||
* @param int $lineNumber
|
||||
* @param int $columnNumber
|
||||
*/
|
||||
public function __construct($lineNumber, $columnNumber = 0)
|
||||
{
|
||||
$this->lineNumber = $lineNumber;
|
||||
$this->columnNumber = $columnNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the line number that is covered by this location.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getLineNumber()
|
||||
{
|
||||
return $this->lineNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the column number (character position on a line) for this location object.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getColumnNumber()
|
||||
{
|
||||
return $this->columnNumber;
|
||||
}
|
||||
}
|
25
vendor/phpdocumentor/reflection-common/src/Project.php
vendored
Normal file
25
vendor/phpdocumentor/reflection-common/src/Project.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor
|
||||
*
|
||||
* PHP Version 5.5
|
||||
*
|
||||
* @copyright 2010-2015 Mike van Riel / Naenius (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection;
|
||||
|
||||
/**
|
||||
* Interface for project. Since the definition of a project can be different per factory this interface will be small.
|
||||
*/
|
||||
interface Project
|
||||
{
|
||||
/**
|
||||
* Returns the name of the project.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName();
|
||||
}
|
27
vendor/phpdocumentor/reflection-common/src/ProjectFactory.php
vendored
Normal file
27
vendor/phpdocumentor/reflection-common/src/ProjectFactory.php
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor
|
||||
*
|
||||
* PHP Version 5.5
|
||||
*
|
||||
* @copyright 2010-2015 Mike van Riel / Naenius (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
namespace phpDocumentor\Reflection;
|
||||
|
||||
/**
|
||||
* Interface for project factories. A project factory shall convert a set of files
|
||||
* into an object implementing the Project interface.
|
||||
*/
|
||||
interface ProjectFactory
|
||||
{
|
||||
/**
|
||||
* Creates a project from the set of files.
|
||||
*
|
||||
* @param string $name
|
||||
* @param File[] $files
|
||||
* @return Project
|
||||
*/
|
||||
public function create($name, array $files);
|
||||
}
|
10
vendor/phpdocumentor/reflection-common/tests/common/bootstrap.php
vendored
Normal file
10
vendor/phpdocumentor/reflection-common/tests/common/bootstrap.php
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor
|
||||
*
|
||||
* PHP Version 5.4
|
||||
*
|
||||
* @copyright 2010-2014 Mike van Riel / Naenius (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
88
vendor/phpdocumentor/reflection-common/tests/unit/FqsenTest.php
vendored
Normal file
88
vendor/phpdocumentor/reflection-common/tests/unit/FqsenTest.php
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor
|
||||
*
|
||||
* PHP Version 5.5
|
||||
*
|
||||
* @copyright 2010-2015 Mike van Riel / Naenius (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection;
|
||||
|
||||
/**
|
||||
* Class FqsenTest
|
||||
* @coversDefaultClass phpDocumentor\Reflection\Fqsen
|
||||
*/
|
||||
class FqsenTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @param string $fqsen
|
||||
* @covers ::__construct
|
||||
* @dataProvider validFqsenProvider
|
||||
*/
|
||||
public function testValidFormats($fqsen, $name)
|
||||
{
|
||||
$instance = new Fqsen($fqsen);
|
||||
$this->assertEquals($name, $instance->getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for ValidFormats tests. Contains a complete list from psr-5 draft.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function validFqsenProvider()
|
||||
{
|
||||
return [
|
||||
['\\', ''],
|
||||
['\My\Space', 'Space'],
|
||||
['\My\Space\myFunction()', 'myFunction'],
|
||||
['\My\Space\MY_CONSTANT', 'MY_CONSTANT'],
|
||||
['\My\Space\MY_CONSTANT2', 'MY_CONSTANT2'],
|
||||
['\My\Space\MyClass', 'MyClass'],
|
||||
['\My\Space\MyInterface', 'MyInterface'],
|
||||
['\My\Space\MyTrait', 'MyTrait'],
|
||||
['\My\Space\MyClass::myMethod()', 'myMethod'],
|
||||
['\My\Space\MyClass::$my_property', 'my_property'],
|
||||
['\My\Space\MyClass::MY_CONSTANT', 'MY_CONSTANT'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $fqsen
|
||||
* @covers ::__construct
|
||||
* @dataProvider invalidFqsenProvider
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInValidFormats($fqsen)
|
||||
{
|
||||
new Fqsen($fqsen);
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for invalidFormats tests. Contains a complete list from psr-5 draft.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function invalidFqsenProvider()
|
||||
{
|
||||
return [
|
||||
['\My\*'],
|
||||
['\My\Space\.()'],
|
||||
['My\Space'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::__construct
|
||||
* @covers ::__toString
|
||||
*/
|
||||
public function testToString()
|
||||
{
|
||||
$className = new Fqsen('\\phpDocumentor\\Application');
|
||||
|
||||
$this->assertEquals('\\phpDocumentor\\Application', (string)$className);
|
||||
}
|
||||
}
|
32
vendor/phpdocumentor/reflection-docblock/.scrutinizer.yml
vendored
Normal file
32
vendor/phpdocumentor/reflection-docblock/.scrutinizer.yml
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
before_commands:
|
||||
- "composer install --no-dev --prefer-source"
|
||||
|
||||
tools:
|
||||
external_code_coverage: true
|
||||
php_code_sniffer:
|
||||
enabled: true
|
||||
config:
|
||||
standard: PSR2
|
||||
filter:
|
||||
paths: ["src/*", "tests/*"]
|
||||
php_cpd:
|
||||
enabled: true
|
||||
excluded_dirs: ["tests", "vendor"]
|
||||
php_loc:
|
||||
enabled: true
|
||||
excluded_dirs: ["tests", "vendor"]
|
||||
php_mess_detector:
|
||||
enabled: true
|
||||
config:
|
||||
ruleset: phpmd.xml.dist
|
||||
design_rules: { eval_expression: false }
|
||||
filter:
|
||||
paths: ["src/*"]
|
||||
php_pdepend:
|
||||
enabled: true
|
||||
excluded_dirs: ["tests", "vendor"]
|
||||
php_analyzer:
|
||||
enabled: true
|
||||
filter:
|
||||
paths: ["src/*", "tests/*"]
|
||||
sensiolabs_security_checker: true
|
@@ -1,28 +1,32 @@
|
||||
language: php
|
||||
php:
|
||||
- 5.3.3
|
||||
- 5.3
|
||||
- 5.4
|
||||
- 5.5
|
||||
- 5.6
|
||||
- 7.0
|
||||
- hhvm
|
||||
- hhvm-nightly
|
||||
- nightly
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- php: hhvm
|
||||
- php: hhvm-nightly
|
||||
allow_failures:
|
||||
- php:
|
||||
- hhvm
|
||||
- nightly
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.composer/cache
|
||||
|
||||
script:
|
||||
- vendor/bin/phpunit
|
||||
- vendor/bin/phpunit --coverage-clover=coverage.clover -v
|
||||
- composer update --no-interaction --prefer-source
|
||||
- vendor/bin/phpunit -v
|
||||
|
||||
before_script:
|
||||
- sudo apt-get -qq update > /dev/null
|
||||
- phpenv rehash > /dev/null
|
||||
- composer selfupdate --quiet
|
||||
- composer install --no-interaction --prefer-source --dev
|
||||
- vendor/bin/phpunit
|
||||
- composer update --no-interaction --prefer-source --dev
|
||||
- composer install --no-interaction
|
||||
|
||||
after_script:
|
||||
- wget https://scrutinizer-ci.com/ocular.phar
|
||||
- php ocular.phar code-coverage:upload --format=php-clover coverage.clover
|
||||
|
||||
notifications:
|
||||
irc: "irc.freenode.org#phpdocumentor"
|
||||
|
@@ -24,34 +24,46 @@ You can install the component in the following ways:
|
||||
Usage
|
||||
-----
|
||||
|
||||
The ReflectionDocBlock component is designed to work in an identical fashion to
|
||||
PHP's own Reflection extension (http://php.net/manual/en/book.reflection.php).
|
||||
In order to parse the DocBlock one needs a DocBlockFactory that can be
|
||||
instantiated using its `createInstance` factory method like this:
|
||||
|
||||
Parsing can be initiated by instantiating the
|
||||
`\phpDocumentor\Reflection\DocBlock()` class and passing it a string containing
|
||||
a DocBlock (including asterisks) or by passing an object supporting the
|
||||
`getDocComment()` method.
|
||||
```php
|
||||
$factory = \phpDocumentor\Reflection\DocBlockFactory::createInstance();
|
||||
```
|
||||
|
||||
> *Examples of objects having the `getDocComment()` method are the
|
||||
> `ReflectionClass` and the `ReflectionMethod` classes of the PHP
|
||||
> Reflection extension*
|
||||
Then we can use the `create` method of the factory to interpret the DocBlock.
|
||||
Please note that it is also possible to provide a class that has the
|
||||
`getDocComment()` method, such as an object of type `ReflectionClass`, the
|
||||
create method will read that if it exists.
|
||||
|
||||
Example:
|
||||
```php
|
||||
$docComment = <<<DOCCOMMENT
|
||||
/**
|
||||
* This is an example of a summary.
|
||||
*
|
||||
* This is a Description. A Summary and Description are separated by either
|
||||
* two subsequent newlines (thus a whiteline in between as can be seen in this
|
||||
* example), or when the Summary ends with a dot (`.`) and some form of
|
||||
* whitespace.
|
||||
*/
|
||||
DOCCOMMENT;
|
||||
|
||||
$class = new ReflectionClass('MyClass');
|
||||
$phpdoc = new \phpDocumentor\Reflection\DocBlock($class);
|
||||
$docblock = $factory->create($docComment);
|
||||
```
|
||||
|
||||
or
|
||||
The `create` method will yield an object of type `\phpDocumentor\Reflection\DocBlock`
|
||||
whose methods can be queried as shown in the following example.
|
||||
|
||||
$docblock = <<<DOCBLOCK
|
||||
/**
|
||||
* This is a short description.
|
||||
*
|
||||
* This is a *long* description.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
DOCBLOCK;
|
||||
```php
|
||||
// Should contain the summary for this DocBlock
|
||||
$summary = $docblock->getSummary();
|
||||
|
||||
$phpdoc = new \phpDocumentor\Reflection\DocBlock($docblock);
|
||||
// Contains an object of type \phpDocumentor\Reflection\DocBlock\Description;
|
||||
// you can either cast it to string or use the render method to get a string
|
||||
// representation of the Description.
|
||||
$description = $docblock->getDescription();
|
||||
```
|
||||
|
||||
> For more examples it would be best to review the scripts in the `/examples`
|
||||
> folder.
|
||||
|
||||
|
@@ -1,26 +1,28 @@
|
||||
{
|
||||
"name": "phpdocumentor/reflection-docblock",
|
||||
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
|
||||
"type": "library",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{"name": "Mike van Riel", "email": "mike.vanriel@naenius.com"}
|
||||
{
|
||||
"name": "Mike van Riel",
|
||||
"email": "me@mikevanriel.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
"php": ">=5.5",
|
||||
"phpdocumentor/reflection-common": "^1.0@dev",
|
||||
"phpdocumentor/type-resolver": "^0.2.0",
|
||||
"webmozart/assert": "^1.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {"phpDocumentor": ["src/"]}
|
||||
"psr-4": {"phpDocumentor\\Reflection\\": ["src/"]}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {"phpDocumentor\\Reflection\\": ["tests/unit"]}
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.0"
|
||||
},
|
||||
"suggest": {
|
||||
"dflydev/markdown": "~1.0",
|
||||
"erusev/parsedown": "~1.0"
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.0.x-dev"
|
||||
}
|
||||
"mockery/mockery": "^0.9.4",
|
||||
"phpunit/phpunit": "^4.4"
|
||||
}
|
||||
}
|
||||
|
687
vendor/phpdocumentor/reflection-docblock/composer.lock
generated
vendored
687
vendor/phpdocumentor/reflection-docblock/composer.lock
generated
vendored
File diff suppressed because it is too large
Load Diff
27
vendor/phpdocumentor/reflection-docblock/examples/01-interpreting-a-simple-docblock.php
vendored
Normal file
27
vendor/phpdocumentor/reflection-docblock/examples/01-interpreting-a-simple-docblock.php
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
require_once(__DIR__ . '/../vendor/autoload.php');
|
||||
|
||||
use phpDocumentor\Reflection\DocBlockFactory;
|
||||
|
||||
$docComment = <<<DOCCOMMENT
|
||||
/**
|
||||
* This is an example of a summary.
|
||||
*
|
||||
* This is a Description. A Summary and Description are separated by either
|
||||
* two subsequent newlines (thus a whiteline in between as can be seen in this
|
||||
* example), or when the Summary ends with a dot (`.`) and some form of
|
||||
* whitespace.
|
||||
*/
|
||||
DOCCOMMENT;
|
||||
|
||||
$factory = DocBlockFactory::createInstance();
|
||||
$docblock = $factory->create($docComment);
|
||||
|
||||
// Should contain the first line of the DocBlock
|
||||
$summary = $docblock->getSummary();
|
||||
|
||||
// Contains an object of type Description; you can either cast it to string or use
|
||||
// the render method to get a string representation of the Description.
|
||||
//
|
||||
// In subsequent examples we will be fiddling a bit more with the Description.
|
||||
$description = $docblock->getDescription();
|
24
vendor/phpdocumentor/reflection-docblock/examples/02-interpreting-tags.php
vendored
Normal file
24
vendor/phpdocumentor/reflection-docblock/examples/02-interpreting-tags.php
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
require_once(__DIR__ . '/../vendor/autoload.php');
|
||||
|
||||
use phpDocumentor\Reflection\DocBlockFactory;
|
||||
|
||||
$docComment = <<<DOCCOMMENT
|
||||
/**
|
||||
* This is an example of a summary.
|
||||
*
|
||||
* @see \phpDocumentor\Reflection\DocBlock\StandardTagFactory
|
||||
*/
|
||||
DOCCOMMENT;
|
||||
|
||||
$factory = DocBlockFactory::createInstance();
|
||||
$docblock = $factory->create($docComment);
|
||||
|
||||
// You can check if a DocBlock has one or more see tags
|
||||
$hasSeeTag = $docblock->hasTag('see');
|
||||
|
||||
// Or we can get a complete list of all tags
|
||||
$tags = $docblock->getTags();
|
||||
|
||||
// But we can also grab all tags of a specific type, such as `see`
|
||||
$seeTags = $docblock->getTagsByName('see');
|
27
vendor/phpdocumentor/reflection-docblock/examples/03-reconstituting-a-docblock.php
vendored
Normal file
27
vendor/phpdocumentor/reflection-docblock/examples/03-reconstituting-a-docblock.php
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
require_once(__DIR__ . '/../vendor/autoload.php');
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Serializer;
|
||||
use phpDocumentor\Reflection\DocBlockFactory;
|
||||
|
||||
$docComment = <<<DOCCOMMENT
|
||||
/**
|
||||
* This is an example of a summary.
|
||||
*
|
||||
* And here is an example of the description
|
||||
* of a DocBlock that can span multiple lines.
|
||||
*
|
||||
* @see \phpDocumentor\Reflection\DocBlock\StandardTagFactory
|
||||
*/
|
||||
DOCCOMMENT;
|
||||
|
||||
$factory = DocBlockFactory::createInstance();
|
||||
$docblock = $factory->create($docComment);
|
||||
|
||||
// Create the serializer that will reconstitute the DocBlock back to its original form.
|
||||
$serializer = new Serializer();
|
||||
|
||||
// Reconstitution is performed by the `getDocComment()` method.
|
||||
$reconstitutedDocComment = $serializer->getDocComment($docblock);
|
||||
|
135
vendor/phpdocumentor/reflection-docblock/examples/04-adding-your-own-tag.php
vendored
Normal file
135
vendor/phpdocumentor/reflection-docblock/examples/04-adding-your-own-tag.php
vendored
Normal file
@@ -0,0 +1,135 @@
|
||||
<?php
|
||||
/**
|
||||
* In this example we demonstrate how you can add your own Tag using a Static Factory method in your Tag class.
|
||||
*/
|
||||
|
||||
require_once(__DIR__ . '/../vendor/autoload.php');
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Serializer;
|
||||
use phpDocumentor\Reflection\DocBlock\Tags\Factory\StaticMethod;
|
||||
use phpDocumentor\Reflection\DocBlockFactory;
|
||||
use phpDocumentor\Reflection\DocBlock\Description;
|
||||
use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
|
||||
use phpDocumentor\Reflection\DocBlock\Tags\BaseTag;
|
||||
use phpDocumentor\Reflection\Types\Context;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
/**
|
||||
* An example of a custom tag called `my-tag` with an optional description.
|
||||
*
|
||||
* A Custom Tag is a class that can consist of two parts:
|
||||
*
|
||||
* 1. a method `create` that is a static factory for this class.
|
||||
* 2. methods and properties that have this object act as an immutable Value Object representing a Tag instance.
|
||||
*
|
||||
* The static factory `create` is used to convert a tag line (without the tag name) into an instance of the
|
||||
* same tag object with the right constructor parameters set. This method has a dynamic list of parameters so that you
|
||||
* can inject various dependencies, see the method's DocBlock for more information.
|
||||
*
|
||||
* An object of this class, and its methods and properties, represent a single instance of that tag in your
|
||||
* documentation in the form of a Value Object whose properties should not be changed after instantiation (it should be
|
||||
* immutable).
|
||||
*
|
||||
* > Important: Tag classes that act as Factories using the `create` method should implement the TagFactory interface.
|
||||
*/
|
||||
final class MyTag extends BaseTag implements StaticMethod
|
||||
{
|
||||
/**
|
||||
* A required property that is used by Formatters to reconstitute the complete tag line.
|
||||
*
|
||||
* @see Formatter
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'my-tag';
|
||||
|
||||
/**
|
||||
* The constructor for this Tag; this should contain all properties for this object.
|
||||
*
|
||||
* @param Description $description An example of how to add a Description to the tag; the Description is often
|
||||
* an optional variable so passing null is allowed in this instance (though you can
|
||||
* also construct an empty description object).
|
||||
*
|
||||
* @see BaseTag for the declaration of the description property and getDescription method.
|
||||
*/
|
||||
public function __construct(Description $description = null)
|
||||
{
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
/**
|
||||
* A static Factory that creates a new instance of the current Tag.
|
||||
*
|
||||
* In this example the MyTag tag can be created by passing a description text as $body. Because we have added
|
||||
* a $descriptionFactory that is type-hinted as DescriptionFactory we can now construct a new Description object
|
||||
* and pass that to the constructor.
|
||||
*
|
||||
* > You could directly instantiate a Description object here but that won't be parsed for inline tags and Types
|
||||
* > won't be resolved. The DescriptionFactory will take care of those actions.
|
||||
*
|
||||
* The `create` method's interface states that this method only features a single parameter (`$body`) but the
|
||||
* {@see TagFactory} will read the signature of this method and if it has more parameters then it will try
|
||||
* to find declarations for it in the ServiceLocator of the TagFactory (see {@see TagFactory::$serviceLocator}).
|
||||
*
|
||||
* > Important: all properties following the `$body` should default to `null`, otherwise PHP will error because
|
||||
* > it no longer matches the interface. This is why you often see the default tags check that an optional argument
|
||||
* > is not null nonetheless.
|
||||
*
|
||||
* @param string $body
|
||||
* @param DescriptionFactory $descriptionFactory
|
||||
* @param Context|null $context The Context is used to resolve Types and FQSENs, although optional
|
||||
* it is highly recommended to pass it. If you omit it then it is assumed that
|
||||
* the DocBlock is in the global namespace and has no `use` statements.
|
||||
*
|
||||
* @see Tag for the interface declaration of the `create` method.
|
||||
* @see Tag::create() for more information on this method's workings.
|
||||
*
|
||||
* @return MyTag
|
||||
*/
|
||||
public static function create($body, DescriptionFactory $descriptionFactory = null, Context $context = null)
|
||||
{
|
||||
Assert::string($body);
|
||||
Assert::notNull($descriptionFactory);
|
||||
|
||||
return new static($descriptionFactory->create($body, $context));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a rendition of the original tag line.
|
||||
*
|
||||
* This method is used to reconstitute a DocBlock into its original form by the {@see Serializer}. It should
|
||||
* feature all parts of the tag so that the serializer can put it back together.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return (string)$this->description;
|
||||
}
|
||||
}
|
||||
|
||||
$docComment = <<<DOCCOMMENT
|
||||
/**
|
||||
* This is an example of a summary.
|
||||
*
|
||||
* @my-tag I have a description
|
||||
*/
|
||||
DOCCOMMENT;
|
||||
|
||||
// Make a mapping between the tag name `my-tag` and the Tag class containing the Factory Method `create`.
|
||||
$customTags = ['my-tag' => MyTag::class];
|
||||
|
||||
// Do pass the list of custom tags to the Factory for the DocBlockFactory.
|
||||
$factory = DocBlockFactory::createInstance($customTags);
|
||||
// You can also add Tags later using `$factory->registerTagHandler()` with a tag name and Tag class name.
|
||||
|
||||
// Create the DocBlock
|
||||
$docblock = $factory->create($docComment);
|
||||
|
||||
// Take a look: the $customTagObjects now contain an array with your newly added tag
|
||||
$customTagObjects = $docblock->getTagsByName('my-tag');
|
||||
|
||||
// As an experiment: let's reconstitute the DocBlock and observe that because we added a __toString() method
|
||||
// to the tag class that we can now also see it.
|
||||
$serializer = new Serializer();
|
||||
$reconstitutedDocComment = $serializer->getDocComment($docblock);
|
47
vendor/phpdocumentor/reflection-docblock/examples/playing-with-descriptions/02-escaping.php
vendored
Normal file
47
vendor/phpdocumentor/reflection-docblock/examples/playing-with-descriptions/02-escaping.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once(__DIR__ . '/../../vendor/autoload.php');
|
||||
|
||||
use phpDocumentor\Reflection\DocBlockFactory;
|
||||
|
||||
$docComment = <<<DOCCOMMENT
|
||||
/**
|
||||
* This is an example of a summary.
|
||||
*
|
||||
* You can escape the @-sign by surrounding it with braces, for example: {@}. And escape a closing brace within an
|
||||
* inline tag by adding an opening brace in front of it like this: {}.
|
||||
*
|
||||
* Here are example texts where you can see how they could be used in a real life situation:
|
||||
*
|
||||
* This is a text with an {@internal inline tag where a closing brace ({}) is shown}.
|
||||
* Or an {@internal inline tag with a literal {{@}link{} in it}.
|
||||
*
|
||||
* Do note that an {@internal inline tag that has an opening brace ({) does not break out}.
|
||||
*/
|
||||
DOCCOMMENT;
|
||||
|
||||
$factory = DocBlockFactory::createInstance();
|
||||
$docblock = $factory->create($docComment);
|
||||
|
||||
// Escaping is automatic so this happens in the DescriptionFactory.
|
||||
$description = $docblock->getDescription();
|
||||
|
||||
// This is the rendition that we will receive of the Description.
|
||||
$receivedDocComment = <<<DOCCOMMENT
|
||||
/**
|
||||
* This is an example of a summary.
|
||||
*
|
||||
* You can escape the @-sign by surrounding it with braces, for example: {@}. And escape a closing brace within an
|
||||
* inline tag by adding an opening brace in front of it like this: {}.
|
||||
*
|
||||
* Here are example texts where you can see how they could be used in a real life situation:
|
||||
*
|
||||
* This is a text with an {@internal inline tag where a closing brace ({}) is shown}.
|
||||
* Or an {@internal inline tag with a literal {{@}link{} in it}.
|
||||
*
|
||||
* Do note that an {@internal inline tag that has an opening brace ({) does not break out}.
|
||||
*/
|
||||
DOCCOMMENT;
|
||||
|
||||
// Render it using the default PassthroughFormatter
|
||||
$foundDescription = $description->render();
|
23
vendor/phpdocumentor/reflection-docblock/phpmd.xml.dist
vendored
Normal file
23
vendor/phpdocumentor/reflection-docblock/phpmd.xml.dist
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<ruleset
|
||||
name="ProxyManager rules"
|
||||
xmlns="http://pmd.sf.net/ruleset/1.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
|
||||
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd"
|
||||
>
|
||||
<rule ref="rulesets/codesize.xml"/>
|
||||
<rule ref="rulesets/unusedcode.xml"/>
|
||||
<rule ref="rulesets/design.xml">
|
||||
<!-- eval is needed to generate runtime classes -->
|
||||
<exclude name="EvalExpression"/>
|
||||
</rule>
|
||||
<rule ref="rulesets/naming.xml">
|
||||
<exclude name="LongVariable"/>
|
||||
</rule>
|
||||
<rule ref="rulesets/naming.xml/LongVariable">
|
||||
<properties>
|
||||
<property name="minimum">40</property>
|
||||
</properties>
|
||||
</rule>
|
||||
</ruleset>
|
@@ -1,14 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<phpunit colors="true" strict="true" bootstrap="vendor/autoload.php">
|
||||
<phpunit
|
||||
colors="true"
|
||||
checkForUnintentionallyCoveredCode="true"
|
||||
beStrictAboutOutputDuringTests="true"
|
||||
forceCoversAnnotation="true"
|
||||
verbose="true"
|
||||
bootstrap="vendor/autoload.php"
|
||||
>
|
||||
<testsuites>
|
||||
<testsuite name="phpDocumentor\Reflection\DocBlock">
|
||||
<directory>./tests/</directory>
|
||||
<testsuite name="unit">
|
||||
<directory>./tests/unit</directory>
|
||||
</testsuite>
|
||||
<testsuite name="integration">
|
||||
<directory>./tests/integration</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<filter>
|
||||
<whitelist>
|
||||
<directory suffix=".php">./src/</directory>
|
||||
</whitelist>
|
||||
<blacklist>
|
||||
<directory>./vendor/</directory>
|
||||
</blacklist>
|
||||
</filter>
|
||||
<listeners>
|
||||
<listener
|
||||
class="Mockery\Adapter\Phpunit\TestListener"
|
||||
file="vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/TestListener.php"
|
||||
/>
|
||||
</listeners>
|
||||
</phpunit>
|
||||
|
220
vendor/phpdocumentor/reflection-docblock/src/DocBlock.php
vendored
Normal file
220
vendor/phpdocumentor/reflection-docblock/src/DocBlock.php
vendored
Normal file
@@ -0,0 +1,220 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of phpDocumentor.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Tag;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
final class DocBlock
|
||||
{
|
||||
/** @var string The opening line for this docblock. */
|
||||
private $summary = '';
|
||||
|
||||
/** @var DocBlock\Description The actual description for this docblock. */
|
||||
private $description = null;
|
||||
|
||||
/** @var Tag[] An array containing all the tags in this docblock; except inline. */
|
||||
private $tags = array();
|
||||
|
||||
/** @var Types\Context Information about the context of this DocBlock. */
|
||||
private $context = null;
|
||||
|
||||
/** @var Location Information about the location of this DocBlock. */
|
||||
private $location = null;
|
||||
|
||||
/** @var bool Is this DocBlock (the start of) a template? */
|
||||
private $isTemplateStart = false;
|
||||
|
||||
/** @var bool Does this DocBlock signify the end of a DocBlock template? */
|
||||
private $isTemplateEnd = false;
|
||||
|
||||
/**
|
||||
* @param string $summary
|
||||
* @param DocBlock\Description $description
|
||||
* @param DocBlock\Tag[] $tags
|
||||
* @param Types\Context $context The context in which the DocBlock occurs.
|
||||
* @param Location $location The location within the file that this DocBlock occurs in.
|
||||
* @param bool $isTemplateStart
|
||||
* @param bool $isTemplateEnd
|
||||
*/
|
||||
public function __construct(
|
||||
$summary = '',
|
||||
DocBlock\Description $description = null,
|
||||
array $tags = [],
|
||||
Types\Context $context = null,
|
||||
Location $location = null,
|
||||
$isTemplateStart = false,
|
||||
$isTemplateEnd = false
|
||||
)
|
||||
{
|
||||
Assert::string($summary);
|
||||
Assert::boolean($isTemplateStart);
|
||||
Assert::boolean($isTemplateEnd);
|
||||
Assert::allIsInstanceOf($tags, Tag::class);
|
||||
|
||||
$this->summary = $summary;
|
||||
$this->description = $description ?: new DocBlock\Description('');
|
||||
foreach ($tags as $tag) {
|
||||
$this->addTag($tag);
|
||||
}
|
||||
|
||||
$this->context = $context;
|
||||
$this->location = $location;
|
||||
|
||||
$this->isTemplateEnd = $isTemplateEnd;
|
||||
$this->isTemplateStart = $isTemplateStart;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getSummary()
|
||||
{
|
||||
return $this->summary;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DocBlock\Description
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current context.
|
||||
*
|
||||
* @return Types\Context
|
||||
*/
|
||||
public function getContext()
|
||||
{
|
||||
return $this->context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current location.
|
||||
*
|
||||
* @return Location
|
||||
*/
|
||||
public function getLocation()
|
||||
{
|
||||
return $this->location;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this DocBlock is the start of a Template section.
|
||||
*
|
||||
* A Docblock may serve as template for a series of subsequent DocBlocks. This is indicated by a special marker
|
||||
* (`#@+`) that is appended directly after the opening `/**` of a DocBlock.
|
||||
*
|
||||
* An example of such an opening is:
|
||||
*
|
||||
* ```
|
||||
* /**#@+
|
||||
* * My DocBlock
|
||||
* * /
|
||||
* ```
|
||||
*
|
||||
* The description and tags (not the summary!) are copied onto all subsequent DocBlocks and also applied to all
|
||||
* elements that follow until another DocBlock is found that contains the closing marker (`#@-`).
|
||||
*
|
||||
* @see self::isTemplateEnd() for the check whether a closing marker was provided.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isTemplateStart()
|
||||
{
|
||||
return $this->isTemplateStart;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this DocBlock is the end of a Template section.
|
||||
*
|
||||
* @see self::isTemplateStart() for a more complete description of the Docblock Template functionality.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isTemplateEnd()
|
||||
{
|
||||
return $this->isTemplateEnd;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tags for this DocBlock.
|
||||
*
|
||||
* @return Tag[]
|
||||
*/
|
||||
public function getTags()
|
||||
{
|
||||
return $this->tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of tags matching the given name. If no tags are found
|
||||
* an empty array is returned.
|
||||
*
|
||||
* @param string $name String to search by.
|
||||
*
|
||||
* @return Tag[]
|
||||
*/
|
||||
public function getTagsByName($name)
|
||||
{
|
||||
Assert::string($name);
|
||||
|
||||
$result = array();
|
||||
|
||||
/** @var Tag $tag */
|
||||
foreach ($this->getTags() as $tag) {
|
||||
if ($tag->getName() != $name) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$result[] = $tag;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a tag of a certain type is present in this DocBlock.
|
||||
*
|
||||
* @param string $name Tag name to check for.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasTag($name)
|
||||
{
|
||||
Assert::string($name);
|
||||
|
||||
/** @var Tag $tag */
|
||||
foreach ($this->getTags() as $tag) {
|
||||
if ($tag->getName() == $name) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a tag to this DocBlock.
|
||||
*
|
||||
* @param Tag $tag The tag to add.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function addTag(Tag $tag)
|
||||
{
|
||||
$this->tags[] = $tag;
|
||||
}
|
||||
}
|
103
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Description.php
vendored
Normal file
103
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Description.php
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of phpDocumentor.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Tags\Formatter;
|
||||
use phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
/**
|
||||
* Object representing to description for a DocBlock.
|
||||
*
|
||||
* A Description object can consist of plain text but can also include tags. A Description Formatter can then combine
|
||||
* a body template with sprintf-style placeholders together with formatted tags in order to reconstitute a complete
|
||||
* description text using the format that you would prefer.
|
||||
*
|
||||
* Because parsing a Description text can be a verbose process this is handled by the {@see DescriptionFactory}. It is
|
||||
* thus recommended to use that to create a Description object, like this:
|
||||
*
|
||||
* $description = $descriptionFactory->create('This is a {@see Description}', $context);
|
||||
*
|
||||
* The description factory will interpret the given body and create a body template and list of tags from them, and pass
|
||||
* that onto the constructor if this class.
|
||||
*
|
||||
* > The $context variable is a class of type {@see \phpDocumentor\Reflection\Types\Context} and contains the namespace
|
||||
* > and the namespace aliases that apply to this DocBlock. These are used by the Factory to resolve and expand partial
|
||||
* > type names and FQSENs.
|
||||
*
|
||||
* If you do not want to use the DescriptionFactory you can pass a body template and tag listing like this:
|
||||
*
|
||||
* $description = new Description(
|
||||
* 'This is a %1$s',
|
||||
* [ new See(new Fqsen('\phpDocumentor\Reflection\DocBlock\Description')) ]
|
||||
* );
|
||||
*
|
||||
* It is generally recommended to use the Factory as that will also apply escaping rules, while the Description object
|
||||
* is mainly responsible for rendering.
|
||||
*
|
||||
* @see DescriptionFactory to create a new Description.
|
||||
* @see Description\Formatter for the formatting of the body and tags.
|
||||
*/
|
||||
class Description
|
||||
{
|
||||
/** @var string */
|
||||
private $bodyTemplate;
|
||||
|
||||
/** @var Tag[] */
|
||||
private $tags;
|
||||
|
||||
/**
|
||||
* Initializes a Description with its body (template) and a listing of the tags used in the body template.
|
||||
*
|
||||
* @param string $bodyTemplate
|
||||
* @param Tag[] $tags
|
||||
*/
|
||||
public function __construct($bodyTemplate, array $tags = [])
|
||||
{
|
||||
Assert::string($bodyTemplate);
|
||||
|
||||
$this->bodyTemplate = $bodyTemplate;
|
||||
$this->tags = $tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders this description as a string where the provided formatter will format the tags in the expected string
|
||||
* format.
|
||||
*
|
||||
* @param Formatter|null $formatter
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function render(Formatter $formatter = null)
|
||||
{
|
||||
if ($formatter === null) {
|
||||
$formatter = new PassthroughFormatter();
|
||||
}
|
||||
|
||||
$tags = [];
|
||||
foreach ($this->tags as $tag) {
|
||||
$tags[] = '{' . $formatter->format($tag) . '}';
|
||||
}
|
||||
return vsprintf($this->bodyTemplate, $tags);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a plain string representation of this description.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->render();
|
||||
}
|
||||
}
|
191
vendor/phpdocumentor/reflection-docblock/src/DocBlock/DescriptionFactory.php
vendored
Normal file
191
vendor/phpdocumentor/reflection-docblock/src/DocBlock/DescriptionFactory.php
vendored
Normal file
@@ -0,0 +1,191 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of phpDocumentor.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock;
|
||||
|
||||
use phpDocumentor\Reflection\Types\Context as TypeContext;
|
||||
|
||||
/**
|
||||
* Creates a new Description object given a body of text.
|
||||
*
|
||||
* Descriptions in phpDocumentor are somewhat complex entities as they can contain one or more tags inside their
|
||||
* body that can be replaced with a readable output. The replacing is done by passing a Formatter object to the
|
||||
* Description object's `render` method.
|
||||
*
|
||||
* In addition to the above does a Description support two types of escape sequences:
|
||||
*
|
||||
* 1. `{@}` to escape the `@` character to prevent it from being interpreted as part of a tag, i.e. `{{@}link}`
|
||||
* 2. `{}` to escape the `}` character, this can be used if you want to use the `}` character in the description
|
||||
* of an inline tag.
|
||||
*
|
||||
* If a body consists of multiple lines then this factory will also remove any superfluous whitespace at the beginning
|
||||
* of each line while maintaining any indentation that is used. This will prevent formatting parsers from tripping
|
||||
* over unexpected spaces as can be observed with tag descriptions.
|
||||
*/
|
||||
class DescriptionFactory
|
||||
{
|
||||
/** @var TagFactory */
|
||||
private $tagFactory;
|
||||
|
||||
/**
|
||||
* Initializes this factory with the means to construct (inline) tags.
|
||||
*
|
||||
* @param TagFactory $tagFactory
|
||||
*/
|
||||
public function __construct(TagFactory $tagFactory)
|
||||
{
|
||||
$this->tagFactory = $tagFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the parsed text of this description.
|
||||
*
|
||||
* @param string $contents
|
||||
* @param TypeContext $context
|
||||
*
|
||||
* @return Description
|
||||
*/
|
||||
public function create($contents, TypeContext $context = null)
|
||||
{
|
||||
list($text, $tags) = $this->parse($this->lex($contents), $context);
|
||||
|
||||
return new Description($text, $tags);
|
||||
}
|
||||
|
||||
/**
|
||||
* Strips the contents from superfluous whitespace and splits the description into a series of tokens.
|
||||
*
|
||||
* @param string $contents
|
||||
*
|
||||
* @return string[] A series of tokens of which the description text is composed.
|
||||
*/
|
||||
private function lex($contents)
|
||||
{
|
||||
$contents = $this->removeSuperfluousStartingWhitespace($contents);
|
||||
|
||||
// performance optimalization; if there is no inline tag, don't bother splitting it up.
|
||||
if (strpos($contents, '{@') === false) {
|
||||
return [$contents];
|
||||
}
|
||||
|
||||
return preg_split(
|
||||
'/\{
|
||||
# "{@}" is not a valid inline tag. This ensures that we do not treat it as one, but treat it literally.
|
||||
(?!@\})
|
||||
# We want to capture the whole tag line, but without the inline tag delimiters.
|
||||
(\@
|
||||
# Match everything up to the next delimiter.
|
||||
[^{}]*
|
||||
# Nested inline tag content should not be captured, or it will appear in the result separately.
|
||||
(?:
|
||||
# Match nested inline tags.
|
||||
(?:
|
||||
# Because we did not catch the tag delimiters earlier, we must be explicit with them here.
|
||||
# Notice that this also matches "{}", as a way to later introduce it as an escape sequence.
|
||||
\{(?1)?\}
|
||||
|
|
||||
# Make sure we match hanging "{".
|
||||
\{
|
||||
)
|
||||
# Match content after the nested inline tag.
|
||||
[^{}]*
|
||||
)* # If there are more inline tags, match them as well. We use "*" since there may not be any
|
||||
# nested inline tags.
|
||||
)
|
||||
\}/Sux',
|
||||
$contents,
|
||||
null,
|
||||
PREG_SPLIT_DELIM_CAPTURE
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the stream of tokens in to a new set of tokens containing Tags.
|
||||
*
|
||||
* @param string[] $tokens
|
||||
* @param TypeContext $context
|
||||
*
|
||||
* @return string[]|Tag[]
|
||||
*/
|
||||
private function parse($tokens, TypeContext $context)
|
||||
{
|
||||
$count = count($tokens);
|
||||
$tagCount = 0;
|
||||
$tags = [];
|
||||
|
||||
for ($i = 1; $i < $count; $i += 2) {
|
||||
$tags[] = $this->tagFactory->create($tokens[$i], $context);
|
||||
$tokens[$i] = '%' . ++$tagCount . '$s';
|
||||
}
|
||||
|
||||
//In order to allow "literal" inline tags, the otherwise invalid
|
||||
//sequence "{@}" is changed to "@", and "{}" is changed to "}".
|
||||
//See unit tests for examples.
|
||||
for ($i = 0; $i < $count; $i += 2) {
|
||||
$tokens[$i] = str_replace(['{@}', '{}'], ['@', '}'], $tokens[$i]);
|
||||
}
|
||||
|
||||
return [implode('', $tokens), $tags];
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the superfluous from a multi-line description.
|
||||
*
|
||||
* When a description has more than one line then it can happen that the second and subsequent lines have an
|
||||
* additional indentation. This is commonly in use with tags like this:
|
||||
*
|
||||
* {@}since 1.1.0 This is an example
|
||||
* description where we have an
|
||||
* indentation in the second and
|
||||
* subsequent lines.
|
||||
*
|
||||
* If we do not normalize the indentation then we have superfluous whitespace on the second and subsequent
|
||||
* lines and this may cause rendering issues when, for example, using a Markdown converter.
|
||||
*
|
||||
* @param string $contents
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function removeSuperfluousStartingWhitespace($contents)
|
||||
{
|
||||
$lines = explode("\n", $contents);
|
||||
|
||||
// if there is only one line then we don't have lines with superfluous whitespace and
|
||||
// can use the contents as-is
|
||||
if (count($lines) <= 1) {
|
||||
return $contents;
|
||||
}
|
||||
|
||||
// determine how many whitespace characters need to be stripped
|
||||
$startingSpaceCount = 9999999;
|
||||
for ($i = 1; $i < count($lines); $i++) {
|
||||
// lines with a no length do not count as they are not indented at all
|
||||
if (strlen(trim($lines[$i])) === 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// determine the number of prefixing spaces by checking the difference in line length before and after
|
||||
// an ltrim
|
||||
$startingSpaceCount = min($startingSpaceCount, strlen($lines[$i]) - strlen(ltrim($lines[$i])));
|
||||
}
|
||||
|
||||
// strip the number of spaces from each line
|
||||
if ($startingSpaceCount > 0) {
|
||||
for ($i = 1; $i < count($lines); $i++) {
|
||||
$lines[$i] = substr($lines[$i], $startingSpaceCount);
|
||||
}
|
||||
}
|
||||
|
||||
return implode("\n", $lines);
|
||||
}
|
||||
|
||||
}
|
170
vendor/phpdocumentor/reflection-docblock/src/DocBlock/ExampleFinder.php
vendored
Normal file
170
vendor/phpdocumentor/reflection-docblock/src/DocBlock/ExampleFinder.php
vendored
Normal file
@@ -0,0 +1,170 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of phpDocumentor.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Tags\Example;
|
||||
|
||||
/**
|
||||
* Class used to find an example file's location based on a given ExampleDescriptor.
|
||||
*/
|
||||
class ExampleFinder
|
||||
{
|
||||
/** @var string */
|
||||
private $sourceDirectory = '';
|
||||
|
||||
/** @var string[] */
|
||||
private $exampleDirectories = array();
|
||||
|
||||
/**
|
||||
* Attempts to find the example contents for the given descriptor.
|
||||
*
|
||||
* @param Example $example
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function find(Example $example)
|
||||
{
|
||||
$filename = $example->getFilePath();
|
||||
|
||||
$file = $this->getExampleFileContents($filename);
|
||||
if (!$file) {
|
||||
return "** File not found : {$filename} **";
|
||||
}
|
||||
|
||||
return implode('', array_slice($file, $example->getStartingLine() - 1, $example->getLineCount()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the project's root directory where an 'examples' folder can be expected.
|
||||
*
|
||||
* @param string $directory
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setSourceDirectory($directory = '')
|
||||
{
|
||||
$this->sourceDirectory = $directory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the project's root directory where an 'examples' folder can be expected.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSourceDirectory()
|
||||
{
|
||||
return $this->sourceDirectory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a series of directories that may contain examples.
|
||||
*
|
||||
* @param string[] $directories
|
||||
*/
|
||||
public function setExampleDirectories(array $directories)
|
||||
{
|
||||
$this->exampleDirectories = $directories;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a series of directories that may contain examples.
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getExampleDirectories()
|
||||
{
|
||||
return $this->exampleDirectories;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to find the requested example file and returns its contents or null if no file was found.
|
||||
*
|
||||
* This method will try several methods in search of the given example file, the first one it encounters is
|
||||
* returned:
|
||||
*
|
||||
* 1. Iterates through all examples folders for the given filename
|
||||
* 2. Checks the source folder for the given filename
|
||||
* 3. Checks the 'examples' folder in the current working directory for examples
|
||||
* 4. Checks the path relative to the current working directory for the given filename
|
||||
*
|
||||
* @param string $filename
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
private function getExampleFileContents($filename)
|
||||
{
|
||||
$normalizedPath = null;
|
||||
|
||||
foreach ($this->exampleDirectories as $directory) {
|
||||
$exampleFileFromConfig = $this->constructExamplePath($directory, $filename);
|
||||
if (is_readable($exampleFileFromConfig)) {
|
||||
$normalizedPath = $exampleFileFromConfig;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$normalizedPath) {
|
||||
if (is_readable($this->getExamplePathFromSource($filename))) {
|
||||
$normalizedPath = $this->getExamplePathFromSource($filename);
|
||||
} elseif (is_readable($this->getExamplePathFromExampleDirectory($filename))) {
|
||||
$normalizedPath = $this->getExamplePathFromExampleDirectory($filename);
|
||||
} elseif (is_readable($filename)) {
|
||||
$normalizedPath = $filename;
|
||||
}
|
||||
}
|
||||
|
||||
return $normalizedPath && is_readable($normalizedPath) ? file($normalizedPath) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get example filepath based on the example directory inside your project.
|
||||
*
|
||||
* @param string $file
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function getExamplePathFromExampleDirectory($file)
|
||||
{
|
||||
return getcwd() . DIRECTORY_SEPARATOR . 'examples' . DIRECTORY_SEPARATOR . $file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a path to the example file in the given directory..
|
||||
*
|
||||
* @param string $directory
|
||||
* @param string $file
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function constructExamplePath($directory, $file)
|
||||
{
|
||||
return rtrim($directory, '\\/') . DIRECTORY_SEPARATOR . $file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get example filepath based on sourcecode.
|
||||
*
|
||||
* @param string $file
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function getExamplePathFromSource($file)
|
||||
{
|
||||
return sprintf(
|
||||
'%s%s%s',
|
||||
trim($this->getSourceDirectory(), '\\/'),
|
||||
DIRECTORY_SEPARATOR,
|
||||
trim($file, '"')
|
||||
);
|
||||
}
|
||||
}
|
143
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Serializer.php
vendored
Normal file
143
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Serializer.php
vendored
Normal file
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of phpDocumentor.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
/**
|
||||
* Converts a DocBlock back from an object to a complete DocComment including Asterisks.
|
||||
*/
|
||||
class Serializer
|
||||
{
|
||||
/** @var string The string to indent the comment with. */
|
||||
protected $indentString = ' ';
|
||||
|
||||
/** @var int The number of times the indent string is repeated. */
|
||||
protected $indent = 0;
|
||||
|
||||
/** @var bool Whether to indent the first line with the given indent amount and string. */
|
||||
protected $isFirstLineIndented = true;
|
||||
|
||||
/** @var int|null The max length of a line. */
|
||||
protected $lineLength = null;
|
||||
|
||||
/**
|
||||
* Create a Serializer instance.
|
||||
*
|
||||
* @param int $indent The number of times the indent string is repeated.
|
||||
* @param string $indentString The string to indent the comment with.
|
||||
* @param bool $indentFirstLine Whether to indent the first line.
|
||||
* @param int|null $lineLength The max length of a line or NULL to disable line wrapping.
|
||||
*/
|
||||
public function __construct($indent = 0, $indentString = ' ', $indentFirstLine = true, $lineLength = null)
|
||||
{
|
||||
Assert::integer($indent);
|
||||
Assert::string($indentString);
|
||||
Assert::boolean($indentFirstLine);
|
||||
Assert::nullOrInteger($lineLength);
|
||||
|
||||
$this->indent = $indent;
|
||||
$this->indentString = $indentString;
|
||||
$this->isFirstLineIndented = $indentFirstLine;
|
||||
$this->lineLength = $lineLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a DocBlock comment.
|
||||
*
|
||||
* @param DocBlock $docblock The DocBlock to serialize.
|
||||
*
|
||||
* @return string The serialized doc block.
|
||||
*/
|
||||
public function getDocComment(DocBlock $docblock)
|
||||
{
|
||||
$indent = str_repeat($this->indentString, $this->indent);
|
||||
$firstIndent = $this->isFirstLineIndented ? $indent : '';
|
||||
// 3 === strlen(' * ')
|
||||
$wrapLength = $this->lineLength ? $this->lineLength - strlen($indent) - 3 : null;
|
||||
|
||||
$text = $this->removeTrailingSpaces(
|
||||
$indent,
|
||||
$this->addAsterisksForEachLine(
|
||||
$indent,
|
||||
$this->getSummaryAndDescriptionTextBlock($docblock, $wrapLength)
|
||||
)
|
||||
);
|
||||
|
||||
$comment = "{$firstIndent}/**\n{$indent} * {$text}\n{$indent} *\n";
|
||||
$comment = $this->addTagBlock($docblock, $wrapLength, $indent, $comment);
|
||||
$comment .= $indent . ' */';
|
||||
|
||||
return $comment;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $indent
|
||||
* @param $text
|
||||
* @return mixed
|
||||
*/
|
||||
private function removeTrailingSpaces($indent, $text)
|
||||
{
|
||||
return str_replace("\n{$indent} * \n", "\n{$indent} *\n", $text);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $indent
|
||||
* @param $text
|
||||
* @return mixed
|
||||
*/
|
||||
private function addAsterisksForEachLine($indent, $text)
|
||||
{
|
||||
return str_replace("\n", "\n{$indent} * ", $text);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param DocBlock $docblock
|
||||
* @param $wrapLength
|
||||
* @return string
|
||||
*/
|
||||
private function getSummaryAndDescriptionTextBlock(DocBlock $docblock, $wrapLength)
|
||||
{
|
||||
$text = $docblock->getSummary() . ((string)$docblock->getDescription() ? "\n\n" . $docblock->getDescription()
|
||||
: '');
|
||||
if ($wrapLength !== null) {
|
||||
$text = wordwrap($text, $wrapLength);
|
||||
return $text;
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param DocBlock $docblock
|
||||
* @param $wrapLength
|
||||
* @param $indent
|
||||
* @param $comment
|
||||
* @return string
|
||||
*/
|
||||
private function addTagBlock(DocBlock $docblock, $wrapLength, $indent, $comment)
|
||||
{
|
||||
foreach ($docblock->getTags() as $tag) {
|
||||
$formatter = new DocBlock\Tags\Formatter\PassthroughFormatter();
|
||||
$tagText = $formatter->format($tag);
|
||||
if ($wrapLength !== null) {
|
||||
$tagText = wordwrap($tagText, $wrapLength);
|
||||
}
|
||||
$tagText = str_replace("\n", "\n{$indent} * ", $tagText);
|
||||
|
||||
$comment .= "{$indent} * {$tagText}\n";
|
||||
}
|
||||
|
||||
return $comment;
|
||||
}
|
||||
}
|
314
vendor/phpdocumentor/reflection-docblock/src/DocBlock/StandardTagFactory.php
vendored
Normal file
314
vendor/phpdocumentor/reflection-docblock/src/DocBlock/StandardTagFactory.php
vendored
Normal file
@@ -0,0 +1,314 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of phpDocumentor.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Tags\Factory\StaticMethod;
|
||||
use phpDocumentor\Reflection\DocBlock\Tags\Generic;
|
||||
use phpDocumentor\Reflection\FqsenResolver;
|
||||
use phpDocumentor\Reflection\Types\Context as TypeContext;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
/**
|
||||
* Creates a Tag object given the contents of a tag.
|
||||
*
|
||||
* This Factory is capable of determining the appropriate class for a tag and instantiate it using its `create`
|
||||
* factory method. The `create` factory method of a Tag can have a variable number of arguments; this way you can
|
||||
* pass the dependencies that you need to construct a tag object.
|
||||
*
|
||||
* > Important: each parameter in addition to the body variable for the `create` method must default to null, otherwise
|
||||
* > it violates the constraint with the interface; it is recommended to use the {@see Assert::notNull()} method to
|
||||
* > verify that a dependency is actually passed.
|
||||
*
|
||||
* This Factory also features a Service Locator component that is used to pass the right dependencies to the
|
||||
* `create` method of a tag; each dependency should be registered as a service or as a parameter.
|
||||
*
|
||||
* When you want to use a Tag of your own with custom handling you need to call the `registerTagHandler` method, pass
|
||||
* the name of the tag and a Fully Qualified Class Name pointing to a class that implements the Tag interface.
|
||||
*/
|
||||
final class StandardTagFactory implements TagFactory
|
||||
{
|
||||
/** PCRE regular expression matching a tag name. */
|
||||
const REGEX_TAGNAME = '[\w\-\_\\\\]+';
|
||||
|
||||
/**
|
||||
* @var string[] An array with a tag as a key, and an FQCN to a class that handles it as an array value.
|
||||
*/
|
||||
private $tagHandlerMappings = [
|
||||
'author' => '\phpDocumentor\Reflection\DocBlock\Tags\Author',
|
||||
'covers' => '\phpDocumentor\Reflection\DocBlock\Tags\Covers',
|
||||
'deprecated' => '\phpDocumentor\Reflection\DocBlock\Tags\Deprecated',
|
||||
// 'example' => '\phpDocumentor\Reflection\DocBlock\Tags\Example',
|
||||
'link' => '\phpDocumentor\Reflection\DocBlock\Tags\Link',
|
||||
'method' => '\phpDocumentor\Reflection\DocBlock\Tags\Method',
|
||||
'param' => '\phpDocumentor\Reflection\DocBlock\Tags\Param',
|
||||
'property-read' => '\phpDocumentor\Reflection\DocBlock\Tags\PropertyRead',
|
||||
'property' => '\phpDocumentor\Reflection\DocBlock\Tags\Property',
|
||||
'property-write' => '\phpDocumentor\Reflection\DocBlock\Tags\PropertyWrite',
|
||||
'return' => '\phpDocumentor\Reflection\DocBlock\Tags\Return_',
|
||||
'see' => '\phpDocumentor\Reflection\DocBlock\Tags\See',
|
||||
'since' => '\phpDocumentor\Reflection\DocBlock\Tags\Since',
|
||||
'source' => '\phpDocumentor\Reflection\DocBlock\Tags\Source',
|
||||
'throw' => '\phpDocumentor\Reflection\DocBlock\Tags\Throws',
|
||||
'throws' => '\phpDocumentor\Reflection\DocBlock\Tags\Throws',
|
||||
'uses' => '\phpDocumentor\Reflection\DocBlock\Tags\Uses',
|
||||
'var' => '\phpDocumentor\Reflection\DocBlock\Tags\Var_',
|
||||
'version' => '\phpDocumentor\Reflection\DocBlock\Tags\Version'
|
||||
];
|
||||
|
||||
/**
|
||||
* @var \ReflectionParameter[][] a lazy-loading cache containing parameters for each tagHandler that has been used.
|
||||
*/
|
||||
private $tagHandlerParameterCache = [];
|
||||
|
||||
/**
|
||||
* @var FqsenResolver
|
||||
*/
|
||||
private $fqsenResolver;
|
||||
|
||||
/**
|
||||
* @var mixed[] an array representing a simple Service Locator where we can store parameters and
|
||||
* services that can be inserted into the Factory Methods of Tag Handlers.
|
||||
*/
|
||||
private $serviceLocator = [];
|
||||
|
||||
/**
|
||||
* Initialize this tag factory with the means to resolve an FQSEN and optionally a list of tag handlers.
|
||||
*
|
||||
* If no tag handlers are provided than the default list in the {@see self::$tagHandlerMappings} property
|
||||
* is used.
|
||||
*
|
||||
* @param FqsenResolver $fqsenResolver
|
||||
* @param string[] $tagHandlers
|
||||
*
|
||||
* @see self::registerTagHandler() to add a new tag handler to the existing default list.
|
||||
*/
|
||||
public function __construct(FqsenResolver $fqsenResolver, array $tagHandlers = null)
|
||||
{
|
||||
$this->fqsenResolver = $fqsenResolver;
|
||||
if ($tagHandlers !== null) {
|
||||
$this->tagHandlerMappings = $tagHandlers;
|
||||
}
|
||||
|
||||
$this->addService($fqsenResolver, FqsenResolver::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function create($tagLine, TypeContext $context = null)
|
||||
{
|
||||
if (! $context) {
|
||||
$context = new TypeContext('');
|
||||
}
|
||||
|
||||
list($tagName, $tagBody) = $this->extractTagParts($tagLine);
|
||||
|
||||
return $this->createTag($tagBody, $tagName, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function addParameter($name, $value)
|
||||
{
|
||||
$this->serviceLocator[$name] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function addService($service, $alias = null)
|
||||
{
|
||||
$this->serviceLocator[$alias ?: get_class($service)] = $service;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function registerTagHandler($tagName, $handler)
|
||||
{
|
||||
Assert::stringNotEmpty($tagName);
|
||||
Assert::stringNotEmpty($handler);
|
||||
Assert::classExists($handler);
|
||||
Assert::implementsInterface($handler, StaticMethod::class);
|
||||
|
||||
if (strpos($tagName, '\\') && $tagName[0] !== '\\') {
|
||||
throw new \InvalidArgumentException(
|
||||
'A namespaced tag must have a leading backslash as it must be fully qualified'
|
||||
);
|
||||
}
|
||||
|
||||
$this->tagHandlerMappings[$tagName] = $handler;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts all components for a tag.
|
||||
*
|
||||
* @param string $tagLine
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
private function extractTagParts($tagLine)
|
||||
{
|
||||
$matches = array();
|
||||
if (! preg_match('/^@(' . self::REGEX_TAGNAME . ')(?:\s*([^\s].*)|$)?/us', $tagLine, $matches)) {
|
||||
throw new \InvalidArgumentException(
|
||||
'The tag "' . $tagLine . '" does not seem to be wellformed, please check it for errors'
|
||||
);
|
||||
}
|
||||
|
||||
if (count($matches) < 3) {
|
||||
$matches[] = '';
|
||||
}
|
||||
|
||||
return array_slice($matches, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new tag object with the given name and body or returns null if the tag name was recognized but the
|
||||
* body was invalid.
|
||||
*
|
||||
* @param string $body
|
||||
* @param string $name
|
||||
* @param TypeContext $context
|
||||
*
|
||||
* @return Tag|null
|
||||
*/
|
||||
private function createTag($body, $name, TypeContext $context)
|
||||
{
|
||||
$handlerClassName = $this->findHandlerClassName($name, $context);
|
||||
$arguments = $this->getArgumentsForParametersFromWiring(
|
||||
$this->fetchParametersForHandlerFactoryMethod($handlerClassName),
|
||||
$this->getServiceLocatorWithDynamicParameters($context, $name, $body)
|
||||
)
|
||||
;
|
||||
|
||||
return call_user_func_array([$handlerClassName, 'create'], $arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines the Fully Qualified Class Name of the Factory or Tag (containing a Factory Method `create`).
|
||||
*
|
||||
* @param string $tagName
|
||||
* @param TypeContext $context
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function findHandlerClassName($tagName, TypeContext $context)
|
||||
{
|
||||
$handlerClassName = Generic::class;
|
||||
if (isset($this->tagHandlerMappings[$tagName])) {
|
||||
$handlerClassName = $this->tagHandlerMappings[$tagName];
|
||||
} elseif ($this->isAnnotation($tagName)) {
|
||||
// TODO: Annotation support is planned for a later stage and as such is disabled for now
|
||||
// $tagName = (string)$this->fqsenResolver->resolve($tagName, $context);
|
||||
// if (isset($this->annotationMappings[$tagName])) {
|
||||
// $handlerClassName = $this->annotationMappings[$tagName];
|
||||
// }
|
||||
}
|
||||
|
||||
return $handlerClassName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the arguments that need to be passed to the Factory Method with the given Parameters.
|
||||
*
|
||||
* @param \ReflectionParameter[] $parameters
|
||||
* @param mixed[] $locator
|
||||
*
|
||||
* @return mixed[] A series of values that can be passed to the Factory Method of the tag whose parameters
|
||||
* is provided with this method.
|
||||
*/
|
||||
private function getArgumentsForParametersFromWiring($parameters, $locator)
|
||||
{
|
||||
$arguments = [];
|
||||
foreach ($parameters as $index => $parameter) {
|
||||
$typeHint = $parameter->getClass() ? $parameter->getClass()->getName() : null;
|
||||
if (isset($locator[$typeHint])) {
|
||||
$arguments[] = $locator[$typeHint];
|
||||
continue;
|
||||
}
|
||||
|
||||
$parameterName = $parameter->getName();
|
||||
if (isset($locator[$parameterName])) {
|
||||
$arguments[] = $locator[$parameterName];
|
||||
continue;
|
||||
}
|
||||
|
||||
$arguments[] = null;
|
||||
}
|
||||
|
||||
return $arguments;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a series of ReflectionParameter objects for the static 'create' method of the given
|
||||
* tag handler class name.
|
||||
*
|
||||
* @param string $handlerClassName
|
||||
*
|
||||
* @return \ReflectionParameter[]
|
||||
*/
|
||||
private function fetchParametersForHandlerFactoryMethod($handlerClassName)
|
||||
{
|
||||
if (! isset($this->tagHandlerParameterCache[$handlerClassName])) {
|
||||
$methodReflection = new \ReflectionMethod($handlerClassName, 'create');
|
||||
$this->tagHandlerParameterCache[$handlerClassName] = $methodReflection->getParameters();
|
||||
}
|
||||
|
||||
return $this->tagHandlerParameterCache[$handlerClassName];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this class' Service Locator with added dynamic parameters, such as the tag's name, body and
|
||||
* Context.
|
||||
*
|
||||
* @param TypeContext $context The Context (namespace and aliasses) that may be passed and is used to resolve FQSENs.
|
||||
* @param string $tagName The name of the tag that may be passed onto the factory method of the Tag class.
|
||||
* @param string $tagBody The body of the tag that may be passed onto the factory method of the Tag class.
|
||||
*
|
||||
* @return mixed[]
|
||||
*/
|
||||
private function getServiceLocatorWithDynamicParameters(TypeContext $context, $tagName, $tagBody)
|
||||
{
|
||||
$locator = array_merge(
|
||||
$this->serviceLocator,
|
||||
[
|
||||
'name' => $tagName,
|
||||
'body' => $tagBody,
|
||||
TypeContext::class => $context
|
||||
]
|
||||
);
|
||||
|
||||
return $locator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the given tag belongs to an annotation.
|
||||
*
|
||||
* @param string $tagContent
|
||||
*
|
||||
* @todo this method should be populated once we implement Annotation notation support.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function isAnnotation($tagContent)
|
||||
{
|
||||
// 1. Contains a namespace separator
|
||||
// 2. Contains parenthesis
|
||||
// 3. Is present in a list of known annotations (make the algorithm smart by first checking is the last part
|
||||
// of the annotation class name matches the found tag name
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
26
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tag.php
vendored
Normal file
26
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tag.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of phpDocumentor.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Tags\Formatter;
|
||||
|
||||
interface Tag
|
||||
{
|
||||
public function getName();
|
||||
|
||||
public static function create($body);
|
||||
|
||||
public function render(Formatter $formatter = null);
|
||||
|
||||
public function __toString();
|
||||
}
|
93
vendor/phpdocumentor/reflection-docblock/src/DocBlock/TagFactory.php
vendored
Normal file
93
vendor/phpdocumentor/reflection-docblock/src/DocBlock/TagFactory.php
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of phpDocumentor.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock;
|
||||
|
||||
use phpDocumentor\Reflection\Types\Context as TypeContext;
|
||||
|
||||
interface TagFactory
|
||||
{
|
||||
/**
|
||||
* Adds a parameter to the service locator that can be injected in a tag's factory method.
|
||||
*
|
||||
* When calling a tag's "create" method we always check the signature for dependencies to inject. One way is to
|
||||
* typehint a parameter in the signature so that we can use that interface or class name to inject a dependency
|
||||
* (see {@see addService()} for more information on that).
|
||||
*
|
||||
* Another way is to check the name of the argument against the names in the Service Locator. With this method
|
||||
* you can add a variable that will be inserted when a tag's create method is not typehinted and has a matching
|
||||
* name.
|
||||
*
|
||||
* Be aware that there are two reserved names:
|
||||
*
|
||||
* - name, representing the name of the tag.
|
||||
* - body, representing the complete body of the tag.
|
||||
*
|
||||
* These parameters are injected at the last moment and will override any existing parameter with those names.
|
||||
*
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addParameter($name, $value);
|
||||
|
||||
/**
|
||||
* Registers a service with the Service Locator using the FQCN of the class or the alias, if provided.
|
||||
*
|
||||
* When calling a tag's "create" method we always check the signature for dependencies to inject. If a parameter
|
||||
* has a typehint then the ServiceLocator is queried to see if a Service is registered for that typehint.
|
||||
*
|
||||
* Because interfaces are regularly used as type-hints this method provides an alias parameter; if the FQCN of the
|
||||
* interface is passed as alias then every time that interface is requested the provided service will be returned.
|
||||
*
|
||||
* @param object $service
|
||||
* @param string $alias
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addService($service);
|
||||
|
||||
/**
|
||||
* Factory method responsible for instantiating the correct sub type.
|
||||
*
|
||||
* @param string $tagLine The text for this tag, including description.
|
||||
* @param TypeContext $context
|
||||
*
|
||||
* @throws \InvalidArgumentException if an invalid tag line was presented.
|
||||
*
|
||||
* @return Tag A new tag object.
|
||||
*/
|
||||
public function create($tagLine, TypeContext $context = null);
|
||||
|
||||
/**
|
||||
* Registers a handler for tags.
|
||||
*
|
||||
* If you want to use your own tags then you can use this method to instruct the TagFactory to register the name
|
||||
* of a tag with the FQCN of a 'Tag Handler'. The Tag handler should implement the {@see Tag} interface (and thus
|
||||
* the create method).
|
||||
*
|
||||
* @param string $tagName Name of tag to register a handler for. When registering a namespaced tag, the full
|
||||
* name, along with a prefixing slash MUST be provided.
|
||||
* @param string $handler FQCN of handler.
|
||||
*
|
||||
* @throws \InvalidArgumentException if the tag name is not a string
|
||||
* @throws \InvalidArgumentException if the tag name is namespaced (contains backslashes) but does not start with
|
||||
* a backslash
|
||||
* @throws \InvalidArgumentException if the handler is not a string
|
||||
* @throws \InvalidArgumentException if the handler is not an existing class
|
||||
* @throws \InvalidArgumentException if the handler does not implement the {@see Tag} interface
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function registerTagHandler($tagName, $handler);
|
||||
}
|
100
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Author.php
vendored
Normal file
100
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Author.php
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of phpDocumentor.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tags;
|
||||
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
/**
|
||||
* Reflection class for an {@}author tag in a Docblock.
|
||||
*/
|
||||
final class Author extends BaseTag implements Factory\StaticMethod
|
||||
{
|
||||
/** @var string register that this is the author tag. */
|
||||
protected $name = 'author';
|
||||
|
||||
/** @var string The name of the author */
|
||||
private $authorName = '';
|
||||
|
||||
/** @var string The email of the author */
|
||||
private $authorEmail = '';
|
||||
|
||||
/**
|
||||
* Initializes this tag with the author name and e-mail.
|
||||
*
|
||||
* @param string $authorName
|
||||
* @param string $authorEmail
|
||||
*/
|
||||
public function __construct($authorName, $authorEmail)
|
||||
{
|
||||
Assert::string($authorName);
|
||||
Assert::string($authorEmail);
|
||||
if ($authorEmail && !filter_var($authorEmail, FILTER_VALIDATE_EMAIL)) {
|
||||
throw new \InvalidArgumentException('The author tag does not have a valid e-mail address');
|
||||
}
|
||||
|
||||
$this->authorName = $authorName;
|
||||
$this->authorEmail = $authorEmail;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the author's name.
|
||||
*
|
||||
* @return string The author's name.
|
||||
*/
|
||||
public function getAuthorName()
|
||||
{
|
||||
return $this->authorName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the author's email.
|
||||
*
|
||||
* @return string The author's email.
|
||||
*/
|
||||
public function getEmail()
|
||||
{
|
||||
return $this->authorEmail;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns this tag in string form.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->authorName . '<' . $this->authorEmail . '>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to create a new Author object based on †he tag body.
|
||||
*
|
||||
* @param string $body
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public static function create($body)
|
||||
{
|
||||
Assert::string($body);
|
||||
|
||||
$splitTagContent = preg_match('/^([^\<]*)(?:\<([^\>]*)\>)?$/u', $body, $matches);
|
||||
if (!$splitTagContent) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$authorName = trim($matches[1]);
|
||||
$email = isset($matches[2]) ? trim($matches[2]) : '';
|
||||
|
||||
return new static($authorName, $email);
|
||||
}
|
||||
}
|
52
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/BaseTag.php
vendored
Normal file
52
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/BaseTag.php
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of phpDocumentor.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tags;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock;
|
||||
use phpDocumentor\Reflection\DocBlock\Description;
|
||||
|
||||
/**
|
||||
* Parses a tag definition for a DocBlock.
|
||||
*/
|
||||
abstract class BaseTag implements DocBlock\Tag
|
||||
{
|
||||
/** @var string Name of the tag */
|
||||
protected $name = '';
|
||||
|
||||
/** @var Description|null Description of the tag. */
|
||||
protected $description;
|
||||
|
||||
/**
|
||||
* Gets the name of this tag.
|
||||
*
|
||||
* @return string The name of this tag.
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
public function render(Formatter $formatter = null)
|
||||
{
|
||||
if ($formatter === null) {
|
||||
$formatter = new Formatter\PassthroughFormatter();
|
||||
}
|
||||
|
||||
return $formatter->format($this);
|
||||
}
|
||||
}
|
84
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Covers.php
vendored
Normal file
84
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Covers.php
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of phpDocumentor.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tags;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
|
||||
use phpDocumentor\Reflection\Fqsen;
|
||||
use phpDocumentor\Reflection\DocBlock\Description;
|
||||
use phpDocumentor\Reflection\Types\Context as TypeContext;
|
||||
use phpDocumentor\Reflection\FqsenResolver;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
/**
|
||||
* Reflection class for a @covers tag in a Docblock.
|
||||
*/
|
||||
final class Covers extends BaseTag implements Factory\StaticMethod
|
||||
{
|
||||
protected $name = 'covers';
|
||||
|
||||
/** @var Fqsen */
|
||||
private $refers = null;
|
||||
|
||||
/**
|
||||
* Initializes this tag.
|
||||
*
|
||||
* @param Fqsen $refers
|
||||
* @param Description $description
|
||||
*/
|
||||
public function __construct(Fqsen $refers, Description $description = null)
|
||||
{
|
||||
$this->refers = $refers;
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function create(
|
||||
$body,
|
||||
DescriptionFactory $descriptionFactory = null,
|
||||
FqsenResolver $resolver = null,
|
||||
TypeContext $context = null
|
||||
)
|
||||
{
|
||||
Assert::string($body);
|
||||
Assert::notEmpty($body);
|
||||
|
||||
$parts = preg_split('/\s+/Su', $body, 2);
|
||||
|
||||
return new static(
|
||||
$resolver->resolve($parts[0], $context),
|
||||
$descriptionFactory->create(isset($parts[1]) ? $parts[1] : '', $context)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the structural element this tag refers to.
|
||||
*
|
||||
* @return Fqsen
|
||||
*/
|
||||
public function getReference()
|
||||
{
|
||||
return $this->refers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of this tag.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->refers . ($this->description ? ' ' . $this->description->render() : '');
|
||||
}
|
||||
}
|
94
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Deprecated.php
vendored
Normal file
94
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Deprecated.php
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of phpDocumentor.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tags;
|
||||
|
||||
use phpDocumentor\Reflection\Types\Context as TypeContext;
|
||||
use phpDocumentor\Reflection\DocBlock\Description;
|
||||
use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
/**
|
||||
* Reflection class for a {@}deprecated tag in a Docblock.
|
||||
*/
|
||||
final class Deprecated extends BaseTag implements Factory\StaticMethod
|
||||
{
|
||||
protected $name = 'deprecated';
|
||||
|
||||
/**
|
||||
* PCRE regular expression matching a version vector.
|
||||
* Assumes the "x" modifier.
|
||||
*/
|
||||
const REGEX_VECTOR = '(?:
|
||||
# Normal release vectors.
|
||||
\d\S*
|
||||
|
|
||||
# VCS version vectors. Per PHPCS, they are expected to
|
||||
# follow the form of the VCS name, followed by ":", followed
|
||||
# by the version vector itself.
|
||||
# By convention, popular VCSes like CVS, SVN and GIT use "$"
|
||||
# around the actual version vector.
|
||||
[^\s\:]+\:\s*\$[^\$]+\$
|
||||
)';
|
||||
|
||||
/** @var string The version vector. */
|
||||
private $version = '';
|
||||
|
||||
public function __construct($version = null, Description $description = null)
|
||||
{
|
||||
Assert::nullOrStringNotEmpty($version);
|
||||
|
||||
$this->version = $version;
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return static
|
||||
*/
|
||||
public static function create($body, DescriptionFactory $descriptionFactory = null, TypeContext $context = null)
|
||||
{
|
||||
Assert::nullOrString($body);
|
||||
if (empty($body)) {
|
||||
return new static();
|
||||
}
|
||||
|
||||
$matches = [];
|
||||
if (!preg_match('/^(' . self::REGEX_VECTOR . ')\s*(.+)?$/sux', $body, $matches)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new static(
|
||||
$matches[1],
|
||||
$descriptionFactory->create(isset($matches[2]) ? $matches[2] : '', $context)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the version section of the tag.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getVersion()
|
||||
{
|
||||
return $this->version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation for this tag.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->version . ($this->description ? ' ' . $this->description->render() : '');
|
||||
}
|
||||
}
|
158
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Example.php
vendored
Normal file
158
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Example.php
vendored
Normal file
@@ -0,0 +1,158 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of phpDocumentor.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tags;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
/**
|
||||
* Reflection class for a {@}example tag in a Docblock.
|
||||
*/
|
||||
final class Example extends BaseTag
|
||||
{
|
||||
/**
|
||||
* @var string Path to a file to use as an example. May also be an absolute URI.
|
||||
*/
|
||||
private $filePath = '';
|
||||
|
||||
/**
|
||||
* @var bool Whether the file path component represents an URI. This determines how the file portion
|
||||
* appears at {@link getContent()}.
|
||||
*/
|
||||
private $isURI = false;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getContent()
|
||||
{
|
||||
if (null === $this->description) {
|
||||
$filePath = '"' . $this->filePath . '"';
|
||||
if ($this->isURI) {
|
||||
$filePath = $this->isUriRelative($this->filePath)
|
||||
? str_replace('%2F', '/', rawurlencode($this->filePath))
|
||||
:$this->filePath;
|
||||
}
|
||||
|
||||
$this->description = $filePath . ' ' . parent::getContent();
|
||||
}
|
||||
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function create($body)
|
||||
{
|
||||
// File component: File path in quotes or File URI / Source information
|
||||
if (! preg_match('/^(?:\"([^\"]+)\"|(\S+))(?:\s+(.*))?$/sux', $body, $matches)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$filePath = null;
|
||||
$fileUri = null;
|
||||
if ('' !== $matches[1]) {
|
||||
$filePath = $matches[1];
|
||||
} else {
|
||||
$fileUri = $matches[2];
|
||||
}
|
||||
|
||||
$startingLine = 1;
|
||||
$lineCount = null;
|
||||
$description = null;
|
||||
|
||||
// Starting line / Number of lines / Description
|
||||
if (preg_match('/^([1-9]\d*)\s*(?:((?1))\s+)?(.*)$/sux', $matches[3], $matches)) {
|
||||
$startingLine = (int)$matches[1];
|
||||
if (isset($matches[2]) && $matches[2] !== '') {
|
||||
$lineCount = (int)$matches[2];
|
||||
}
|
||||
$description = $matches[3];
|
||||
}
|
||||
|
||||
return new static($filePath, $fileUri, $startingLine, $lineCount, $description);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the file path.
|
||||
*
|
||||
* @return string Path to a file to use as an example.
|
||||
* May also be an absolute URI.
|
||||
*/
|
||||
public function getFilePath()
|
||||
{
|
||||
return $this->filePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the file path.
|
||||
*
|
||||
* @param string $filePath The new file path to use for the example.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setFilePath($filePath)
|
||||
{
|
||||
$this->isURI = false;
|
||||
$this->filePath = trim($filePath);
|
||||
|
||||
$this->description = null;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the file path as an URI.
|
||||
*
|
||||
* This function is equivalent to {@link setFilePath()}, except that it
|
||||
* converts an URI to a file path before that.
|
||||
*
|
||||
* There is no getFileURI(), as {@link getFilePath()} is compatible.
|
||||
*
|
||||
* @param string $uri The new file URI to use as an example.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setFileURI($uri)
|
||||
{
|
||||
$this->isURI = true;
|
||||
$this->description = null;
|
||||
|
||||
$this->filePath = $this->isUriRelative($uri)
|
||||
? rawurldecode(str_replace(array('/', '\\'), '%2F', $uri))
|
||||
: $this->filePath = $uri;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation for this tag.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->filePath . ($this->description ? ' ' . $this->description->render() : '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the provided URI is relative or contains a complete scheme (and thus is absolute).
|
||||
*
|
||||
* @param string $uri
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function isUriRelative($uri)
|
||||
{
|
||||
return false === strpos($uri, ':');
|
||||
}
|
||||
}
|
18
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Factory/StaticMethod.php
vendored
Normal file
18
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Factory/StaticMethod.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of phpDocumentor.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tags\Factory;
|
||||
|
||||
interface StaticMethod
|
||||
{
|
||||
public static function create($body);
|
||||
}
|
18
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Factory/Strategy.php
vendored
Normal file
18
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Factory/Strategy.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of phpDocumentor.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tags\Factory;
|
||||
|
||||
interface Strategy
|
||||
{
|
||||
public function create($body);
|
||||
}
|
27
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Formatter.php
vendored
Normal file
27
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Formatter.php
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of phpDocumentor.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tags;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
interface Formatter
|
||||
{
|
||||
/**
|
||||
* Formats a tag into a string representation according to a specific format, such as Markdown.
|
||||
*
|
||||
* @param Tag $tag
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function format(Tag $tag);
|
||||
}
|
31
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Formatter/PassthroughFormatter.php
vendored
Normal file
31
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Formatter/PassthroughFormatter.php
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of phpDocumentor.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tags\Formatter;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Tag;
|
||||
use phpDocumentor\Reflection\DocBlock\Tags\Formatter;
|
||||
|
||||
class PassthroughFormatter implements Formatter
|
||||
{
|
||||
/**
|
||||
* Formats the given tag to return a simple plain text version.
|
||||
*
|
||||
* @param Tag $tag
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function format(Tag $tag)
|
||||
{
|
||||
return '@' . $tag->getName() . ' ' . (string)$tag;
|
||||
}
|
||||
}
|
91
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Generic.php
vendored
Normal file
91
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Generic.php
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of phpDocumentor.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tags;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Description;
|
||||
use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
|
||||
use phpDocumentor\Reflection\DocBlock\StandardTagFactory;
|
||||
use phpDocumentor\Reflection\Types\Context as TypeContext;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
/**
|
||||
* Parses a tag definition for a DocBlock.
|
||||
*/
|
||||
class Generic extends BaseTag implements Factory\StaticMethod
|
||||
{
|
||||
/**
|
||||
* Parses a tag and populates the member variables.
|
||||
*
|
||||
* @param string $name Name of the tag.
|
||||
* @param Description $description The contents of the given tag.
|
||||
*/
|
||||
public function __construct($name, Description $description = null)
|
||||
{
|
||||
$this->validateTagName($name);
|
||||
|
||||
$this->name = $name;
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new tag that represents any unknown tag type.
|
||||
*
|
||||
* @param string $body
|
||||
* @param string $name
|
||||
* @param DescriptionFactory $descriptionFactory
|
||||
* @param TypeContext $context
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public static function create(
|
||||
$body,
|
||||
$name = '',
|
||||
DescriptionFactory $descriptionFactory = null,
|
||||
TypeContext $context = null
|
||||
) {
|
||||
Assert::string($body);
|
||||
Assert::stringNotEmpty($name);
|
||||
Assert::notNull($descriptionFactory);
|
||||
|
||||
$description = $descriptionFactory && $body ? $descriptionFactory->create($body, $context) : null;
|
||||
|
||||
return new static($name, $description);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tag as a serialized string
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return ($this->description ? $this->description->render() : '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates if the tag name matches the expected format, otherwise throws an exception.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function validateTagName($name)
|
||||
{
|
||||
if (! preg_match('/^' . StandardTagFactory::REGEX_TAGNAME . '$/u', $name)) {
|
||||
throw new \InvalidArgumentException(
|
||||
'The tag name "' . $name . '" is not wellformed. Tags may only consist of letters, underscores, '
|
||||
. 'hyphens and backslashes.'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
77
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Link.php
vendored
Normal file
77
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Link.php
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Ben Selby <benmatselby@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tags;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Description;
|
||||
use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
|
||||
use phpDocumentor\Reflection\Types\Context as TypeContext;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
/**
|
||||
* Reflection class for a @link tag in a Docblock.
|
||||
*/
|
||||
final class Link extends BaseTag implements Factory\StaticMethod
|
||||
{
|
||||
protected $name = 'link';
|
||||
|
||||
/** @var string */
|
||||
private $link = '';
|
||||
|
||||
/**
|
||||
* Initializes a link to a URL.
|
||||
*
|
||||
* @param string $link
|
||||
* @param Description $description
|
||||
*/
|
||||
public function __construct($link, Description $description = null)
|
||||
{
|
||||
Assert::string($link);
|
||||
|
||||
$this->link = $link;
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function create($body, DescriptionFactory $descriptionFactory = null, TypeContext $context = null)
|
||||
{
|
||||
Assert::string($body);
|
||||
Assert::notNull($descriptionFactory);
|
||||
|
||||
$parts = preg_split('/\s+/Su', $body, 2);
|
||||
$description = isset($parts[1]) ? $descriptionFactory->create($parts[1], $context) : null;
|
||||
|
||||
return new static($parts[0], $description);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the link
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLink()
|
||||
{
|
||||
return $this->link;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation for this tag.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->link . ($this->description ? ' ' . $this->description->render() : '');
|
||||
}
|
||||
}
|
220
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Method.php
vendored
Normal file
220
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Method.php
vendored
Normal file
@@ -0,0 +1,220 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of phpDocumentor.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tags;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Description;
|
||||
use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
|
||||
use phpDocumentor\Reflection\Type;
|
||||
use phpDocumentor\Reflection\TypeResolver;
|
||||
use phpDocumentor\Reflection\Types\Context as TypeContext;
|
||||
use phpDocumentor\Reflection\Types\Void_;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
/**
|
||||
* Reflection class for an {@}method in a Docblock.
|
||||
*/
|
||||
final class Method extends BaseTag implements Factory\StaticMethod
|
||||
{
|
||||
protected $name = 'method';
|
||||
|
||||
/** @var string */
|
||||
private $methodName = '';
|
||||
|
||||
/** @var string[] */
|
||||
private $arguments = [];
|
||||
|
||||
/** @var bool */
|
||||
private $isStatic = false;
|
||||
|
||||
/** @var Type */
|
||||
private $returnType;
|
||||
|
||||
public function __construct(
|
||||
$methodName,
|
||||
array $arguments = [],
|
||||
Type $returnType = null,
|
||||
$static = false,
|
||||
Description $description = null
|
||||
) {
|
||||
Assert::stringNotEmpty($methodName);
|
||||
Assert::boolean($static);
|
||||
|
||||
if ($returnType === null) {
|
||||
$returnType = new Void_();
|
||||
}
|
||||
|
||||
$this->methodName = $methodName;
|
||||
$this->arguments = $this->filterArguments($arguments);
|
||||
$this->returnType = $returnType;
|
||||
$this->isStatic = $static;
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function create(
|
||||
$body,
|
||||
TypeResolver $typeResolver = null,
|
||||
DescriptionFactory $descriptionFactory = null,
|
||||
TypeContext $context = null
|
||||
) {
|
||||
Assert::stringNotEmpty($body);
|
||||
Assert::allNotNull([ $typeResolver, $descriptionFactory ]);
|
||||
|
||||
// 1. none or more whitespace
|
||||
// 2. optionally the keyword "static" followed by whitespace
|
||||
// 3. optionally a word with underscores followed by whitespace : as
|
||||
// type for the return value
|
||||
// 4. then optionally a word with underscores followed by () and
|
||||
// whitespace : as method name as used by phpDocumentor
|
||||
// 5. then a word with underscores, followed by ( and any character
|
||||
// until a ) and whitespace : as method name with signature
|
||||
// 6. any remaining text : as description
|
||||
if (!preg_match(
|
||||
'/^
|
||||
# Static keyword
|
||||
# Declares a static method ONLY if type is also present
|
||||
(?:
|
||||
(static)
|
||||
\s+
|
||||
)?
|
||||
# Return type
|
||||
(?:
|
||||
(
|
||||
(?:[\w\|_\\\\]+)
|
||||
# array notation
|
||||
(?:\[\])*
|
||||
)?
|
||||
\s+
|
||||
)?
|
||||
# Legacy method name (not captured)
|
||||
(?:
|
||||
[\w_]+\(\)\s+
|
||||
)?
|
||||
# Method name
|
||||
([\w\|_\\\\]+)
|
||||
# Arguments
|
||||
(?:
|
||||
\(([^\)]*)\)
|
||||
)?
|
||||
\s*
|
||||
# Description
|
||||
(.*)
|
||||
$/sux',
|
||||
$body,
|
||||
$matches
|
||||
)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
list(, $static, $returnType, $methodName, $arguments, $description) = $matches;
|
||||
|
||||
$static = $static === 'static';
|
||||
$returnType = $typeResolver->resolve($returnType, $context);
|
||||
$description = $descriptionFactory->create($description, $context);
|
||||
|
||||
if ('' !== $arguments) {
|
||||
$arguments = explode(',', $arguments);
|
||||
foreach($arguments as &$argument) {
|
||||
$argument = explode(' ', trim($argument));
|
||||
if ($argument[0][0] === '$') {
|
||||
$argumentName = substr($argument[0], 1);
|
||||
$argumentType = new Void_();
|
||||
} else {
|
||||
$argumentType = $typeResolver->resolve($argument[0], $context);
|
||||
$argumentName = '';
|
||||
if (isset($argument[1])) {
|
||||
$argumentName = substr($argument[1], 1);
|
||||
}
|
||||
}
|
||||
|
||||
$argument = [ 'name' => $argumentName, 'type' => $argumentType];
|
||||
}
|
||||
} else {
|
||||
$arguments = [];
|
||||
}
|
||||
|
||||
return new static($methodName, $arguments, $returnType, $static, $description);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the method name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getMethodName()
|
||||
{
|
||||
return $this->methodName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function getArguments()
|
||||
{
|
||||
return $this->arguments;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the method tag describes a static method or not.
|
||||
*
|
||||
* @return bool TRUE if the method declaration is for a static method, FALSE otherwise.
|
||||
*/
|
||||
public function isStatic()
|
||||
{
|
||||
return $this->isStatic;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Type
|
||||
*/
|
||||
public function getReturnType()
|
||||
{
|
||||
return $this->returnType;
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
$arguments = [];
|
||||
foreach ($this->arguments as $argument) {
|
||||
$arguments[] = $argument['type'] . ' $' . $argument['name'];
|
||||
}
|
||||
|
||||
return ($this->isStatic() ? 'static ' : '')
|
||||
. (string)$this->returnType . ' '
|
||||
. $this->methodName
|
||||
. '(' . implode(', ', $arguments) . ')'
|
||||
. ($this->description ? ' ' . $this->description->render() : '');
|
||||
}
|
||||
|
||||
private function filterArguments($arguments)
|
||||
{
|
||||
foreach ($arguments as &$argument) {
|
||||
if (is_string($argument)) {
|
||||
$argument = [ 'name' => $argument ];
|
||||
}
|
||||
if (! isset($argument['type'])) {
|
||||
$argument['type'] = new Void_();
|
||||
}
|
||||
$keys = array_keys($argument);
|
||||
if ($keys !== [ 'name', 'type' ]) {
|
||||
throw new \InvalidArgumentException(
|
||||
'Arguments can only have the "name" and "type" fields, found: ' . var_export($keys, true)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $arguments;
|
||||
}
|
||||
}
|
141
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Param.php
vendored
Normal file
141
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Param.php
vendored
Normal file
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of phpDocumentor.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tags;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Description;
|
||||
use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
|
||||
use phpDocumentor\Reflection\Type;
|
||||
use phpDocumentor\Reflection\TypeResolver;
|
||||
use phpDocumentor\Reflection\Types\Context as TypeContext;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
/**
|
||||
* Reflection class for the {@}param tag in a Docblock.
|
||||
*/
|
||||
final class Param extends BaseTag implements Factory\StaticMethod
|
||||
{
|
||||
/** @var string */
|
||||
protected $name = 'param';
|
||||
|
||||
/** @var Type */
|
||||
private $type;
|
||||
|
||||
/** @var string */
|
||||
private $variableName = '';
|
||||
|
||||
/** @var bool determines whether this is a variadic argument */
|
||||
private $isVariadic = false;
|
||||
|
||||
/**
|
||||
* @param string $variableName
|
||||
* @param Type $type
|
||||
* @param bool $isVariadic
|
||||
* @param Description $description
|
||||
*/
|
||||
public function __construct($variableName, Type $type = null, $isVariadic = false, Description $description = null)
|
||||
{
|
||||
Assert::string($variableName);
|
||||
Assert::boolean($isVariadic);
|
||||
|
||||
$this->variableName = $variableName;
|
||||
$this->type = $type;
|
||||
$this->isVariadic = $isVariadic;
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function create(
|
||||
$body,
|
||||
TypeResolver $typeResolver = null,
|
||||
DescriptionFactory $descriptionFactory = null,
|
||||
TypeContext $context = null
|
||||
) {
|
||||
Assert::stringNotEmpty($body);
|
||||
Assert::allNotNull([$typeResolver, $descriptionFactory]);
|
||||
|
||||
$parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE);
|
||||
$type = null;
|
||||
$variableName = '';
|
||||
$isVariadic = false;
|
||||
|
||||
// if the first item that is encountered is not a variable; it is a type
|
||||
if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] !== '$')) {
|
||||
$type = $typeResolver->resolve(array_shift($parts), $context);
|
||||
array_shift($parts);
|
||||
}
|
||||
|
||||
// if the next item starts with a $ or ...$ it must be the variable name
|
||||
if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] == '$' || substr($parts[0], 0, 4) === '...$')) {
|
||||
$variableName = array_shift($parts);
|
||||
array_shift($parts);
|
||||
|
||||
if (substr($variableName, 0, 3) === '...') {
|
||||
$isVariadic = true;
|
||||
$variableName = substr($variableName, 3);
|
||||
}
|
||||
|
||||
if (substr($variableName, 0, 1) === '$') {
|
||||
$variableName = substr($variableName, 1);
|
||||
}
|
||||
}
|
||||
|
||||
$description = $descriptionFactory->create(implode('', $parts), $context);
|
||||
|
||||
return new static($variableName, $type, $isVariadic, $description);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the variable's name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getVariableName()
|
||||
{
|
||||
return $this->variableName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the variable's type or null if unknown.
|
||||
*
|
||||
* @return Type|null
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this tag is variadic.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isVariadic()
|
||||
{
|
||||
return $this->isVariadic;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation for this tag.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return ($this->type ? $this->type . ' ' : '')
|
||||
. ($this->isVariadic() ? '...' : '')
|
||||
. '$' . $this->variableName
|
||||
. ($this->description ? ' ' . $this->description : '');
|
||||
}
|
||||
}
|
118
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Property.php
vendored
Normal file
118
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Property.php
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of phpDocumentor.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tags;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Description;
|
||||
use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
|
||||
use phpDocumentor\Reflection\Type;
|
||||
use phpDocumentor\Reflection\TypeResolver;
|
||||
use phpDocumentor\Reflection\Types\Context as TypeContext;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
/**
|
||||
* Reflection class for a {@}property tag in a Docblock.
|
||||
*/
|
||||
class Property extends BaseTag implements Factory\StaticMethod
|
||||
{
|
||||
/** @var string */
|
||||
protected $name = 'property';
|
||||
|
||||
/** @var Type */
|
||||
private $type;
|
||||
|
||||
/** @var string */
|
||||
protected $variableName = '';
|
||||
|
||||
/**
|
||||
* @param string $variableName
|
||||
* @param Type $type
|
||||
* @param Description $description
|
||||
*/
|
||||
public function __construct($variableName, Type $type = null, Description $description = null)
|
||||
{
|
||||
Assert::string($variableName);
|
||||
|
||||
$this->variableName = $variableName;
|
||||
$this->type = $type;
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function create(
|
||||
$body,
|
||||
TypeResolver $typeResolver = null,
|
||||
DescriptionFactory $descriptionFactory = null,
|
||||
TypeContext $context = null
|
||||
) {
|
||||
Assert::stringNotEmpty($body);
|
||||
Assert::allNotNull([$typeResolver, $descriptionFactory]);
|
||||
|
||||
$parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE);
|
||||
$type = null;
|
||||
$variableName = '';
|
||||
|
||||
// if the first item that is encountered is not a variable; it is a type
|
||||
if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] !== '$')) {
|
||||
$type = $typeResolver->resolve(array_shift($parts), $context);
|
||||
array_shift($parts);
|
||||
}
|
||||
|
||||
// if the next item starts with a $ or ...$ it must be the variable name
|
||||
if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] == '$')) {
|
||||
$variableName = array_shift($parts);
|
||||
array_shift($parts);
|
||||
|
||||
if (substr($variableName, 0, 1) === '$') {
|
||||
$variableName = substr($variableName, 1);
|
||||
}
|
||||
}
|
||||
|
||||
$description = $descriptionFactory->create(implode('', $parts), $context);
|
||||
|
||||
return new static($variableName, $type, $description);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the variable's name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getVariableName()
|
||||
{
|
||||
return $this->variableName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the variable's type or null if unknown.
|
||||
*
|
||||
* @return Type|null
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation for this tag.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return ($this->type ? $this->type . ' ' : '')
|
||||
. '$' . $this->variableName
|
||||
. ($this->description ? ' ' . $this->description : '');
|
||||
}
|
||||
}
|
118
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/PropertyRead.php
vendored
Normal file
118
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/PropertyRead.php
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of phpDocumentor.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tags;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Description;
|
||||
use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
|
||||
use phpDocumentor\Reflection\Type;
|
||||
use phpDocumentor\Reflection\TypeResolver;
|
||||
use phpDocumentor\Reflection\Types\Context as TypeContext;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
/**
|
||||
* Reflection class for a {@}property-read tag in a Docblock.
|
||||
*/
|
||||
class PropertyRead extends BaseTag implements Factory\StaticMethod
|
||||
{
|
||||
/** @var string */
|
||||
protected $name = 'property-read';
|
||||
|
||||
/** @var Type */
|
||||
private $type;
|
||||
|
||||
/** @var string */
|
||||
protected $variableName = '';
|
||||
|
||||
/**
|
||||
* @param string $variableName
|
||||
* @param Type $type
|
||||
* @param Description $description
|
||||
*/
|
||||
public function __construct($variableName, Type $type = null, Description $description = null)
|
||||
{
|
||||
Assert::string($variableName);
|
||||
|
||||
$this->variableName = $variableName;
|
||||
$this->type = $type;
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function create(
|
||||
$body,
|
||||
TypeResolver $typeResolver = null,
|
||||
DescriptionFactory $descriptionFactory = null,
|
||||
TypeContext $context = null
|
||||
) {
|
||||
Assert::stringNotEmpty($body);
|
||||
Assert::allNotNull([$typeResolver, $descriptionFactory]);
|
||||
|
||||
$parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE);
|
||||
$type = null;
|
||||
$variableName = '';
|
||||
|
||||
// if the first item that is encountered is not a variable; it is a type
|
||||
if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] !== '$')) {
|
||||
$type = $typeResolver->resolve(array_shift($parts), $context);
|
||||
array_shift($parts);
|
||||
}
|
||||
|
||||
// if the next item starts with a $ or ...$ it must be the variable name
|
||||
if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] == '$')) {
|
||||
$variableName = array_shift($parts);
|
||||
array_shift($parts);
|
||||
|
||||
if (substr($variableName, 0, 1) === '$') {
|
||||
$variableName = substr($variableName, 1);
|
||||
}
|
||||
}
|
||||
|
||||
$description = $descriptionFactory->create(implode('', $parts), $context);
|
||||
|
||||
return new static($variableName, $type, $description);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the variable's name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getVariableName()
|
||||
{
|
||||
return $this->variableName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the variable's type or null if unknown.
|
||||
*
|
||||
* @return Type|null
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation for this tag.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return ($this->type ? $this->type . ' ' : '')
|
||||
. '$' . $this->variableName
|
||||
. ($this->description ? ' ' . $this->description : '');
|
||||
}
|
||||
}
|
118
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/PropertyWrite.php
vendored
Normal file
118
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/PropertyWrite.php
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of phpDocumentor.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tags;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Description;
|
||||
use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
|
||||
use phpDocumentor\Reflection\Type;
|
||||
use phpDocumentor\Reflection\TypeResolver;
|
||||
use phpDocumentor\Reflection\Types\Context as TypeContext;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
/**
|
||||
* Reflection class for a {@}property-write tag in a Docblock.
|
||||
*/
|
||||
class PropertyWrite extends BaseTag implements Factory\StaticMethod
|
||||
{
|
||||
/** @var string */
|
||||
protected $name = 'property-write';
|
||||
|
||||
/** @var Type */
|
||||
private $type;
|
||||
|
||||
/** @var string */
|
||||
protected $variableName = '';
|
||||
|
||||
/**
|
||||
* @param string $variableName
|
||||
* @param Type $type
|
||||
* @param Description $description
|
||||
*/
|
||||
public function __construct($variableName, Type $type = null, Description $description = null)
|
||||
{
|
||||
Assert::string($variableName);
|
||||
|
||||
$this->variableName = $variableName;
|
||||
$this->type = $type;
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function create(
|
||||
$body,
|
||||
TypeResolver $typeResolver = null,
|
||||
DescriptionFactory $descriptionFactory = null,
|
||||
TypeContext $context = null
|
||||
) {
|
||||
Assert::stringNotEmpty($body);
|
||||
Assert::allNotNull([$typeResolver, $descriptionFactory]);
|
||||
|
||||
$parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE);
|
||||
$type = null;
|
||||
$variableName = '';
|
||||
|
||||
// if the first item that is encountered is not a variable; it is a type
|
||||
if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] !== '$')) {
|
||||
$type = $typeResolver->resolve(array_shift($parts), $context);
|
||||
array_shift($parts);
|
||||
}
|
||||
|
||||
// if the next item starts with a $ or ...$ it must be the variable name
|
||||
if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] == '$')) {
|
||||
$variableName = array_shift($parts);
|
||||
array_shift($parts);
|
||||
|
||||
if (substr($variableName, 0, 1) === '$') {
|
||||
$variableName = substr($variableName, 1);
|
||||
}
|
||||
}
|
||||
|
||||
$description = $descriptionFactory->create(implode('', $parts), $context);
|
||||
|
||||
return new static($variableName, $type, $description);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the variable's name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getVariableName()
|
||||
{
|
||||
return $this->variableName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the variable's type or null if unknown.
|
||||
*
|
||||
* @return Type|null
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation for this tag.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return ($this->type ? $this->type . ' ' : '')
|
||||
. '$' . $this->variableName
|
||||
. ($this->description ? ' ' . $this->description : '');
|
||||
}
|
||||
}
|
73
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Return_.php
vendored
Normal file
73
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Return_.php
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of phpDocumentor.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tags;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Description;
|
||||
use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
|
||||
use phpDocumentor\Reflection\Type;
|
||||
use phpDocumentor\Reflection\TypeResolver;
|
||||
use phpDocumentor\Reflection\Types\Context as TypeContext;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
/**
|
||||
* Reflection class for a {@}return tag in a Docblock.
|
||||
*/
|
||||
final class Return_ extends BaseTag implements Factory\StaticMethod
|
||||
{
|
||||
protected $name = 'return';
|
||||
|
||||
/** @var Type */
|
||||
private $type;
|
||||
|
||||
public function __construct(Type $type, Description $description = null)
|
||||
{
|
||||
$this->type = $type;
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function create(
|
||||
$body,
|
||||
TypeResolver $typeResolver = null,
|
||||
DescriptionFactory $descriptionFactory = null,
|
||||
TypeContext $context = null
|
||||
)
|
||||
{
|
||||
Assert::string($body);
|
||||
Assert::allNotNull([$typeResolver, $descriptionFactory]);
|
||||
|
||||
$parts = preg_split('/\s+/Su', $body, 2);
|
||||
|
||||
$type = $typeResolver->resolve(isset($parts[0]) ? $parts[0] : '', $context);
|
||||
$description = $descriptionFactory->create(isset($parts[1]) ? $parts[1] : '', $context);
|
||||
|
||||
return new static($type, $description);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type section of the variable.
|
||||
*
|
||||
* @return Type
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
return $this->type . ' ' . $this->description;
|
||||
}
|
||||
}
|
81
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/See.php
vendored
Normal file
81
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/See.php
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of phpDocumentor.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tags;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
|
||||
use phpDocumentor\Reflection\Fqsen;
|
||||
use phpDocumentor\Reflection\FqsenResolver;
|
||||
use phpDocumentor\Reflection\Types\Context as TypeContext;
|
||||
use phpDocumentor\Reflection\DocBlock\Description;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
/**
|
||||
* Reflection class for an {@}see tag in a Docblock.
|
||||
*/
|
||||
class See extends BaseTag implements Factory\StaticMethod
|
||||
{
|
||||
protected $name = 'see';
|
||||
|
||||
/** @var Fqsen */
|
||||
protected $refers = null;
|
||||
|
||||
/**
|
||||
* Initializes this tag.
|
||||
*
|
||||
* @param Fqsen $refers
|
||||
* @param Description $description
|
||||
*/
|
||||
public function __construct(Fqsen $refers, Description $description = null)
|
||||
{
|
||||
$this->refers = $refers;
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function create(
|
||||
$body,
|
||||
FqsenResolver $resolver = null,
|
||||
DescriptionFactory $descriptionFactory = null,
|
||||
TypeContext $context = null
|
||||
) {
|
||||
Assert::string($body);
|
||||
Assert::allNotNull([$resolver, $descriptionFactory]);
|
||||
|
||||
$parts = preg_split('/\s+/Su', $body, 2);
|
||||
$description = isset($parts[1]) ? $descriptionFactory->create($parts[1], $context) : null;
|
||||
|
||||
return new static($resolver->resolve($parts[0], $context), $description);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the structural element this tag refers to.
|
||||
*
|
||||
* @return Fqsen
|
||||
*/
|
||||
public function getReference()
|
||||
{
|
||||
return $this->refers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of this tag.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->refers . ($this->description ? ' ' . $this->description->render() : '');
|
||||
}
|
||||
}
|
94
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Since.php
vendored
Normal file
94
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Since.php
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of phpDocumentor.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tags;
|
||||
|
||||
use phpDocumentor\Reflection\Types\Context as TypeContext;
|
||||
use phpDocumentor\Reflection\DocBlock\Description;
|
||||
use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
/**
|
||||
* Reflection class for a {@}since tag in a Docblock.
|
||||
*/
|
||||
final class Since extends BaseTag implements Factory\StaticMethod
|
||||
{
|
||||
protected $name = 'since';
|
||||
|
||||
/**
|
||||
* PCRE regular expression matching a version vector.
|
||||
* Assumes the "x" modifier.
|
||||
*/
|
||||
const REGEX_VECTOR = '(?:
|
||||
# Normal release vectors.
|
||||
\d\S*
|
||||
|
|
||||
# VCS version vectors. Per PHPCS, they are expected to
|
||||
# follow the form of the VCS name, followed by ":", followed
|
||||
# by the version vector itself.
|
||||
# By convention, popular VCSes like CVS, SVN and GIT use "$"
|
||||
# around the actual version vector.
|
||||
[^\s\:]+\:\s*\$[^\$]+\$
|
||||
)';
|
||||
|
||||
/** @var string The version vector. */
|
||||
private $version = '';
|
||||
|
||||
public function __construct($version = null, Description $description = null)
|
||||
{
|
||||
Assert::nullOrStringNotEmpty($version);
|
||||
|
||||
$this->version = $version;
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return static
|
||||
*/
|
||||
public static function create($body, DescriptionFactory $descriptionFactory = null, TypeContext $context = null)
|
||||
{
|
||||
Assert::nullOrString($body);
|
||||
if (empty($body)) {
|
||||
return new static();
|
||||
}
|
||||
|
||||
$matches = [];
|
||||
if (! preg_match('/^(' . self::REGEX_VECTOR . ')\s*(.+)?$/sux', $body, $matches)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new static(
|
||||
$matches[1],
|
||||
$descriptionFactory->create(isset($matches[2]) ? $matches[2] : '', $context)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the version section of the tag.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getVersion()
|
||||
{
|
||||
return $this->version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation for this tag.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->version . ($this->description ? ' ' . $this->description->render() : '');
|
||||
}
|
||||
}
|
96
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Source.php
vendored
Normal file
96
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Source.php
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of phpDocumentor.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tags;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Description;
|
||||
use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
|
||||
use phpDocumentor\Reflection\Types\Context as TypeContext;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
/**
|
||||
* Reflection class for a {@}source tag in a Docblock.
|
||||
*/
|
||||
final class Source extends BaseTag implements Factory\StaticMethod
|
||||
{
|
||||
/** @var string */
|
||||
protected $name = 'source';
|
||||
|
||||
/** @var int The starting line, relative to the structural element's location. */
|
||||
private $startingLine = 1;
|
||||
|
||||
/** @var int|null The number of lines, relative to the starting line. NULL means "to the end". */
|
||||
private $lineCount = null;
|
||||
|
||||
public function __construct($startingLine, $lineCount = null, Description $description = null)
|
||||
{
|
||||
Assert::integerish($startingLine);
|
||||
Assert::nullOrIntegerish($lineCount);
|
||||
|
||||
$this->startingLine = (int)$startingLine;
|
||||
$this->lineCount = $lineCount !== null ? (int)$lineCount : null;
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function create($body, DescriptionFactory $descriptionFactory = null, TypeContext $context = null)
|
||||
{
|
||||
Assert::stringNotEmpty($body);
|
||||
Assert::notNull($descriptionFactory);
|
||||
|
||||
$startingLine = 1;
|
||||
$lineCount = null;
|
||||
$description = null;
|
||||
|
||||
// Starting line / Number of lines / Description
|
||||
if (preg_match('/^([1-9]\d*)\s*(?:((?1))\s+)?(.*)$/sux', $body, $matches)) {
|
||||
$startingLine = (int)$matches[1];
|
||||
if (isset($matches[2]) && $matches[2] !== '') {
|
||||
$lineCount = (int)$matches[2];
|
||||
}
|
||||
$description = $matches[3];
|
||||
}
|
||||
|
||||
return new static($startingLine, $lineCount, $descriptionFactory->create($description, $context));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the starting line.
|
||||
*
|
||||
* @return int The starting line, relative to the structural element's
|
||||
* location.
|
||||
*/
|
||||
public function getStartingLine()
|
||||
{
|
||||
return $this->startingLine;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of lines.
|
||||
*
|
||||
* @return int|null The number of lines, relative to the starting line. NULL
|
||||
* means "to the end".
|
||||
*/
|
||||
public function getLineCount()
|
||||
{
|
||||
return $this->lineCount;
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
return $this->startingLine
|
||||
. ($this->lineCount !== null ? ' ' . $this->lineCount : '')
|
||||
. ($this->description ? ' ' . $this->description->render() : '');
|
||||
}
|
||||
}
|
72
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Throws.php
vendored
Normal file
72
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Throws.php
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of phpDocumentor.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tags;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Description;
|
||||
use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
|
||||
use phpDocumentor\Reflection\Type;
|
||||
use phpDocumentor\Reflection\TypeResolver;
|
||||
use phpDocumentor\Reflection\Types\Context as TypeContext;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
/**
|
||||
* Reflection class for a {@}throws tag in a Docblock.
|
||||
*/
|
||||
final class Throws extends BaseTag implements Factory\StaticMethod
|
||||
{
|
||||
protected $name = 'throws';
|
||||
|
||||
/** @var Type */
|
||||
private $type;
|
||||
|
||||
public function __construct(Type $type, Description $description = null)
|
||||
{
|
||||
$this->type = $type;
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function create(
|
||||
$body,
|
||||
TypeResolver $typeResolver = null,
|
||||
DescriptionFactory $descriptionFactory = null,
|
||||
TypeContext $context = null
|
||||
) {
|
||||
Assert::string($body);
|
||||
Assert::allNotNull([$typeResolver, $descriptionFactory]);
|
||||
|
||||
$parts = preg_split('/\s+/Su', $body, 2);
|
||||
|
||||
$type = $typeResolver->resolve(isset($parts[0]) ? $parts[0] : '', $context);
|
||||
$description = $descriptionFactory->create(isset($parts[1]) ? $parts[1] : '', $context);
|
||||
|
||||
return new static($type, $description);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type section of the variable.
|
||||
*
|
||||
* @return Type
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
return $this->type . ' ' . $this->description;
|
||||
}
|
||||
}
|
83
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Uses.php
vendored
Normal file
83
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Uses.php
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of phpDocumentor.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tags;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Description;
|
||||
use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
|
||||
use phpDocumentor\Reflection\Fqsen;
|
||||
use phpDocumentor\Reflection\FqsenResolver;
|
||||
use phpDocumentor\Reflection\Types\Context as TypeContext;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
/**
|
||||
* Reflection class for a {@}uses tag in a Docblock.
|
||||
*/
|
||||
final class Uses extends BaseTag implements Factory\StaticMethod
|
||||
{
|
||||
protected $name = 'uses';
|
||||
|
||||
/** @var Fqsen */
|
||||
protected $refers = null;
|
||||
|
||||
/**
|
||||
* Initializes this tag.
|
||||
*
|
||||
* @param Fqsen $refers
|
||||
* @param Description $description
|
||||
*/
|
||||
public function __construct(Fqsen $refers, Description $description = null)
|
||||
{
|
||||
$this->refers = $refers;
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function create(
|
||||
$body,
|
||||
FqsenResolver $resolver = null,
|
||||
DescriptionFactory $descriptionFactory = null,
|
||||
TypeContext $context = null
|
||||
) {
|
||||
Assert::string($body);
|
||||
Assert::allNotNull([$resolver, $descriptionFactory]);
|
||||
|
||||
$parts = preg_split('/\s+/Su', $body, 2);
|
||||
|
||||
return new static(
|
||||
$resolver->resolve($parts[0], $context),
|
||||
$descriptionFactory->create(isset($parts[1]) ? $parts[1] : '', $context)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the structural element this tag refers to.
|
||||
*
|
||||
* @return Fqsen
|
||||
*/
|
||||
public function getReference()
|
||||
{
|
||||
return $this->refers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of this tag.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->refers . ' ' . $this->description->render();
|
||||
}
|
||||
}
|
118
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Var_.php
vendored
Normal file
118
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Var_.php
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of phpDocumentor.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tags;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Description;
|
||||
use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
|
||||
use phpDocumentor\Reflection\Type;
|
||||
use phpDocumentor\Reflection\TypeResolver;
|
||||
use phpDocumentor\Reflection\Types\Context as TypeContext;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
/**
|
||||
* Reflection class for a {@}var tag in a Docblock.
|
||||
*/
|
||||
class Var_ extends BaseTag implements Factory\StaticMethod
|
||||
{
|
||||
/** @var string */
|
||||
protected $name = 'var';
|
||||
|
||||
/** @var Type */
|
||||
private $type;
|
||||
|
||||
/** @var string */
|
||||
protected $variableName = '';
|
||||
|
||||
/**
|
||||
* @param string $variableName
|
||||
* @param Type $type
|
||||
* @param Description $description
|
||||
*/
|
||||
public function __construct($variableName, Type $type = null, Description $description = null)
|
||||
{
|
||||
Assert::string($variableName);
|
||||
|
||||
$this->variableName = $variableName;
|
||||
$this->type = $type;
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function create(
|
||||
$body,
|
||||
TypeResolver $typeResolver = null,
|
||||
DescriptionFactory $descriptionFactory = null,
|
||||
TypeContext $context = null
|
||||
) {
|
||||
Assert::stringNotEmpty($body);
|
||||
Assert::allNotNull([$typeResolver, $descriptionFactory]);
|
||||
|
||||
$parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE);
|
||||
$type = null;
|
||||
$variableName = '';
|
||||
|
||||
// if the first item that is encountered is not a variable; it is a type
|
||||
if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] !== '$')) {
|
||||
$type = $typeResolver->resolve(array_shift($parts), $context);
|
||||
array_shift($parts);
|
||||
}
|
||||
|
||||
// if the next item starts with a $ or ...$ it must be the variable name
|
||||
if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] == '$')) {
|
||||
$variableName = array_shift($parts);
|
||||
array_shift($parts);
|
||||
|
||||
if (substr($variableName, 0, 1) === '$') {
|
||||
$variableName = substr($variableName, 1);
|
||||
}
|
||||
}
|
||||
|
||||
$description = $descriptionFactory->create(implode('', $parts), $context);
|
||||
|
||||
return new static($variableName, $type, $description);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the variable's name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getVariableName()
|
||||
{
|
||||
return $this->variableName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the variable's type or null if unknown.
|
||||
*
|
||||
* @return Type|null
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation for this tag.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return ($this->type ? $this->type . ' ' : '')
|
||||
. '$' . $this->variableName
|
||||
. ($this->description ? ' ' . $this->description : '');
|
||||
}
|
||||
}
|
94
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Version.php
vendored
Normal file
94
vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Version.php
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Vasil Rangelov <boen.robot@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tags;
|
||||
|
||||
use phpDocumentor\Reflection\Types\Context as TypeContext;
|
||||
use phpDocumentor\Reflection\DocBlock\Description;
|
||||
use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
/**
|
||||
* Reflection class for a {@}version tag in a Docblock.
|
||||
*/
|
||||
final class Version extends BaseTag implements Factory\StaticMethod
|
||||
{
|
||||
protected $name = 'version';
|
||||
|
||||
/**
|
||||
* PCRE regular expression matching a version vector.
|
||||
* Assumes the "x" modifier.
|
||||
*/
|
||||
const REGEX_VECTOR = '(?:
|
||||
# Normal release vectors.
|
||||
\d\S*
|
||||
|
|
||||
# VCS version vectors. Per PHPCS, they are expected to
|
||||
# follow the form of the VCS name, followed by ":", followed
|
||||
# by the version vector itself.
|
||||
# By convention, popular VCSes like CVS, SVN and GIT use "$"
|
||||
# around the actual version vector.
|
||||
[^\s\:]+\:\s*\$[^\$]+\$
|
||||
)';
|
||||
|
||||
/** @var string The version vector. */
|
||||
private $version = '';
|
||||
|
||||
public function __construct($version = null, Description $description = null)
|
||||
{
|
||||
Assert::nullOrStringNotEmpty($version);
|
||||
|
||||
$this->version = $version;
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return static
|
||||
*/
|
||||
public static function create($body, DescriptionFactory $descriptionFactory = null, TypeContext $context = null)
|
||||
{
|
||||
Assert::nullOrString($body);
|
||||
if (empty($body)) {
|
||||
return new static();
|
||||
}
|
||||
|
||||
$matches = [];
|
||||
if (!preg_match('/^(' . self::REGEX_VECTOR . ')\s*(.+)?$/sux', $body, $matches)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new static(
|
||||
$matches[1],
|
||||
$descriptionFactory->create(isset($matches[2]) ? $matches[2] : '', $context)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the version section of the tag.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getVersion()
|
||||
{
|
||||
return $this->version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation for this tag.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->version . ($this->description ? ' ' . $this->description->render() : '');
|
||||
}
|
||||
}
|
277
vendor/phpdocumentor/reflection-docblock/src/DocBlockFactory.php
vendored
Normal file
277
vendor/phpdocumentor/reflection-docblock/src/DocBlockFactory.php
vendored
Normal file
@@ -0,0 +1,277 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of phpDocumentor.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
|
||||
use phpDocumentor\Reflection\DocBlock\StandardTagFactory;
|
||||
use phpDocumentor\Reflection\DocBlock\Tag;
|
||||
use phpDocumentor\Reflection\DocBlock\TagFactory;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
final class DocBlockFactory implements DocBlockFactoryInterface
|
||||
{
|
||||
/** @var DocBlock\DescriptionFactory */
|
||||
private $descriptionFactory;
|
||||
|
||||
/** @var DocBlock\TagFactory */
|
||||
private $tagFactory;
|
||||
|
||||
/**
|
||||
* Initializes this factory with the required subcontractors.
|
||||
*
|
||||
* @param DescriptionFactory $descriptionFactory
|
||||
* @param TagFactory $tagFactory
|
||||
*/
|
||||
public function __construct(DescriptionFactory $descriptionFactory, TagFactory $tagFactory)
|
||||
{
|
||||
$this->descriptionFactory = $descriptionFactory;
|
||||
$this->tagFactory = $tagFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Factory method for easy instantiation.
|
||||
*
|
||||
* @param string[] $additionalTags
|
||||
*
|
||||
* @return DocBlockFactory
|
||||
*/
|
||||
public static function createInstance(array $additionalTags = [])
|
||||
{
|
||||
$fqsenResolver = new FqsenResolver();
|
||||
$tagFactory = new StandardTagFactory($fqsenResolver);
|
||||
$descriptionFactory = new DescriptionFactory($tagFactory);
|
||||
|
||||
$tagFactory->addService($descriptionFactory);
|
||||
$tagFactory->addService(new TypeResolver($fqsenResolver));
|
||||
|
||||
$docBlockFactory = new self($descriptionFactory, $tagFactory);
|
||||
foreach ($additionalTags as $tagName => $tagHandler) {
|
||||
$docBlockFactory->registerTagHandler($tagName, $tagHandler);
|
||||
}
|
||||
|
||||
return $docBlockFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object|string $docblock A string containing the DocBlock to parse or an object supporting the
|
||||
* getDocComment method (such as a ReflectionClass object).
|
||||
* @param Types\Context $context
|
||||
* @param Location $location
|
||||
*
|
||||
* @return DocBlock
|
||||
*/
|
||||
public function create($docblock, Types\Context $context = null, Location $location = null)
|
||||
{
|
||||
if (is_object($docblock)) {
|
||||
if (!method_exists($docblock, 'getDocComment')) {
|
||||
$exceptionMessage = 'Invalid object passed; the given object must support the getDocComment method';
|
||||
throw new \InvalidArgumentException($exceptionMessage);
|
||||
}
|
||||
|
||||
$docblock = $docblock->getDocComment();
|
||||
}
|
||||
|
||||
Assert::stringNotEmpty($docblock);
|
||||
|
||||
if ($context === null) {
|
||||
$context = new Types\Context('');
|
||||
}
|
||||
|
||||
$parts = $this->splitDocBlock($this->stripDocComment($docblock));
|
||||
list($templateMarker, $summary, $description, $tags) = $parts;
|
||||
|
||||
return new DocBlock(
|
||||
$summary,
|
||||
$description ? $this->descriptionFactory->create($description, $context) : null,
|
||||
array_filter($this->parseTagBlock($tags, $context), function($tag) {
|
||||
return $tag instanceof Tag;
|
||||
}),
|
||||
$context,
|
||||
$location,
|
||||
$templateMarker === '#@+',
|
||||
$templateMarker === '#@-'
|
||||
);
|
||||
}
|
||||
|
||||
public function registerTagHandler($tagName, $handler)
|
||||
{
|
||||
$this->tagFactory->registerTagHandler($tagName, $handler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Strips the asterisks from the DocBlock comment.
|
||||
*
|
||||
* @param string $comment String containing the comment text.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function stripDocComment($comment)
|
||||
{
|
||||
$comment = trim(preg_replace('#[ \t]*(?:\/\*\*|\*\/|\*)?[ \t]{0,1}(.*)?#u', '$1', $comment));
|
||||
|
||||
// reg ex above is not able to remove */ from a single line docblock
|
||||
if (substr($comment, -2) == '*/') {
|
||||
$comment = trim(substr($comment, 0, -2));
|
||||
}
|
||||
|
||||
return str_replace(array("\r\n", "\r"), "\n", $comment);
|
||||
}
|
||||
|
||||
/**
|
||||
* Splits the DocBlock into a template marker, summary, description and block of tags.
|
||||
*
|
||||
* @param string $comment Comment to split into the sub-parts.
|
||||
*
|
||||
* @author Richard van Velzen (@_richardJ) Special thanks to Richard for the regex responsible for the split.
|
||||
* @author Mike van Riel <me@mikevanriel.com> for extending the regex with template marker support.
|
||||
*
|
||||
* @return string[] containing the template marker (if any), summary, description and a string containing the tags.
|
||||
*/
|
||||
private function splitDocBlock($comment)
|
||||
{
|
||||
// Performance improvement cheat: if the first character is an @ then only tags are in this DocBlock. This
|
||||
// method does not split tags so we return this verbatim as the fourth result (tags). This saves us the
|
||||
// performance impact of running a regular expression
|
||||
if (strpos($comment, '@') === 0) {
|
||||
return array('', '', '', $comment);
|
||||
}
|
||||
|
||||
// clears all extra horizontal whitespace from the line endings to prevent parsing issues
|
||||
$comment = preg_replace('/\h*$/Sum', '', $comment);
|
||||
|
||||
/*
|
||||
* Splits the docblock into a template marker, summary, description and tags section.
|
||||
*
|
||||
* - The template marker is empty, #@+ or #@- if the DocBlock starts with either of those (a newline may
|
||||
* occur after it and will be stripped).
|
||||
* - The short description is started from the first character until a dot is encountered followed by a
|
||||
* newline OR two consecutive newlines (horizontal whitespace is taken into account to consider spacing
|
||||
* errors). This is optional.
|
||||
* - The long description, any character until a new line is encountered followed by an @ and word
|
||||
* characters (a tag). This is optional.
|
||||
* - Tags; the remaining characters
|
||||
*
|
||||
* Big thanks to RichardJ for contributing this Regular Expression
|
||||
*/
|
||||
preg_match(
|
||||
'/
|
||||
\A
|
||||
# 1. Extract the template marker
|
||||
(?:(\#\@\+|\#\@\-)\n?)?
|
||||
|
||||
# 2. Extract the summary
|
||||
(?:
|
||||
(?! @\pL ) # The summary may not start with an @
|
||||
(
|
||||
[^\n.]+
|
||||
(?:
|
||||
(?! \. \n | \n{2} ) # End summary upon a dot followed by newline or two newlines
|
||||
[\n.] (?! [ \t]* @\pL ) # End summary when an @ is found as first character on a new line
|
||||
[^\n.]+ # Include anything else
|
||||
)*
|
||||
\.?
|
||||
)?
|
||||
)
|
||||
|
||||
# 3. Extract the description
|
||||
(?:
|
||||
\s* # Some form of whitespace _must_ precede a description because a summary must be there
|
||||
(?! @\pL ) # The description may not start with an @
|
||||
(
|
||||
[^\n]+
|
||||
(?: \n+
|
||||
(?! [ \t]* @\pL ) # End description when an @ is found as first character on a new line
|
||||
[^\n]+ # Include anything else
|
||||
)*
|
||||
)
|
||||
)?
|
||||
|
||||
# 4. Extract the tags (anything that follows)
|
||||
(\s+ [\s\S]*)? # everything that follows
|
||||
/ux',
|
||||
$comment,
|
||||
$matches
|
||||
);
|
||||
array_shift($matches);
|
||||
|
||||
while (count($matches) < 4) {
|
||||
$matches[] = '';
|
||||
}
|
||||
|
||||
return $matches;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the tag objects.
|
||||
*
|
||||
* @param string $tags Tag block to parse.
|
||||
* @param Types\Context $context Context of the parsed Tag
|
||||
*
|
||||
* @return DocBlock\Tag[]
|
||||
*/
|
||||
private function parseTagBlock($tags, Types\Context $context)
|
||||
{
|
||||
$tags = $this->filterTagBlock($tags);
|
||||
if (!$tags) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$result = $this->splitTagBlockIntoTagLines($tags);
|
||||
foreach ($result as $key => $tagLine) {
|
||||
$result[$key] = $this->tagFactory->create(trim($tagLine), $context);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $tags
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
private function splitTagBlockIntoTagLines($tags)
|
||||
{
|
||||
$result = array();
|
||||
foreach (explode("\n", $tags) as $tag_line) {
|
||||
if (isset($tag_line[0]) && ($tag_line[0] === '@')) {
|
||||
$result[] = $tag_line;
|
||||
} else {
|
||||
$result[count($result) - 1] .= "\n" . $tag_line;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $tags
|
||||
* @return string
|
||||
*/
|
||||
private function filterTagBlock($tags)
|
||||
{
|
||||
$tags = trim($tags);
|
||||
if (!$tags) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ('@' !== $tags[0]) {
|
||||
// @codeCoverageIgnoreStart
|
||||
// Can't simulate this; this only happens if there is an error with the parsing of the DocBlock that
|
||||
// we didn't foresee.
|
||||
throw new \LogicException('A tag block started with text instead of an at-sign(@): ' . $tags);
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
|
||||
return $tags;
|
||||
}
|
||||
}
|
23
vendor/phpdocumentor/reflection-docblock/src/DocBlockFactoryInterface.php
vendored
Normal file
23
vendor/phpdocumentor/reflection-docblock/src/DocBlockFactoryInterface.php
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
namespace phpDocumentor\Reflection;
|
||||
|
||||
interface DocBlockFactoryInterface
|
||||
{
|
||||
/**
|
||||
* Factory method for easy instantiation.
|
||||
*
|
||||
* @param string[] $additionalTags
|
||||
*
|
||||
* @return DocBlockFactory
|
||||
*/
|
||||
public static function createInstance(array $additionalTags = []);
|
||||
|
||||
/**
|
||||
* @param string $docblock
|
||||
* @param Types\Context $context
|
||||
* @param Location $location
|
||||
*
|
||||
* @return DocBlock
|
||||
*/
|
||||
public function create($docblock, Types\Context $context = null, Location $location = null);
|
||||
}
|
@@ -1,468 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Tag;
|
||||
use phpDocumentor\Reflection\DocBlock\Context;
|
||||
use phpDocumentor\Reflection\DocBlock\Location;
|
||||
|
||||
/**
|
||||
* Parses the DocBlock for any structure.
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class DocBlock implements \Reflector
|
||||
{
|
||||
/** @var string The opening line for this docblock. */
|
||||
protected $short_description = '';
|
||||
|
||||
/**
|
||||
* @var DocBlock\Description The actual
|
||||
* description for this docblock.
|
||||
*/
|
||||
protected $long_description = null;
|
||||
|
||||
/**
|
||||
* @var Tag[] An array containing all
|
||||
* the tags in this docblock; except inline.
|
||||
*/
|
||||
protected $tags = array();
|
||||
|
||||
/** @var Context Information about the context of this DocBlock. */
|
||||
protected $context = null;
|
||||
|
||||
/** @var Location Information about the location of this DocBlock. */
|
||||
protected $location = null;
|
||||
|
||||
/** @var bool Is this DocBlock (the start of) a template? */
|
||||
protected $isTemplateStart = false;
|
||||
|
||||
/** @var bool Does this DocBlock signify the end of a DocBlock template? */
|
||||
protected $isTemplateEnd = false;
|
||||
|
||||
/**
|
||||
* Parses the given docblock and populates the member fields.
|
||||
*
|
||||
* The constructor may also receive namespace information such as the
|
||||
* current namespace and aliases. This information is used by some tags
|
||||
* (e.g. @return, @param, etc.) to turn a relative Type into a FQCN.
|
||||
*
|
||||
* @param \Reflector|string $docblock A docblock comment (including
|
||||
* asterisks) or reflector supporting the getDocComment method.
|
||||
* @param Context $context The context in which the DocBlock
|
||||
* occurs.
|
||||
* @param Location $location The location within the file that this
|
||||
* DocBlock occurs in.
|
||||
*
|
||||
* @throws \InvalidArgumentException if the given argument does not have the
|
||||
* getDocComment method.
|
||||
*/
|
||||
public function __construct(
|
||||
$docblock,
|
||||
Context $context = null,
|
||||
Location $location = null
|
||||
) {
|
||||
if (is_object($docblock)) {
|
||||
if (!method_exists($docblock, 'getDocComment')) {
|
||||
throw new \InvalidArgumentException(
|
||||
'Invalid object passed; the given reflector must support '
|
||||
. 'the getDocComment method'
|
||||
);
|
||||
}
|
||||
|
||||
$docblock = $docblock->getDocComment();
|
||||
}
|
||||
|
||||
$docblock = $this->cleanInput($docblock);
|
||||
|
||||
list($templateMarker, $short, $long, $tags) = $this->splitDocBlock($docblock);
|
||||
$this->isTemplateStart = $templateMarker === '#@+';
|
||||
$this->isTemplateEnd = $templateMarker === '#@-';
|
||||
$this->short_description = $short;
|
||||
$this->long_description = new DocBlock\Description($long, $this);
|
||||
$this->parseTags($tags);
|
||||
|
||||
$this->context = $context;
|
||||
$this->location = $location;
|
||||
}
|
||||
|
||||
/**
|
||||
* Strips the asterisks from the DocBlock comment.
|
||||
*
|
||||
* @param string $comment String containing the comment text.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function cleanInput($comment)
|
||||
{
|
||||
$comment = trim(
|
||||
preg_replace(
|
||||
'#[ \t]*(?:\/\*\*|\*\/|\*)?[ \t]{0,1}(.*)?#u',
|
||||
'$1',
|
||||
$comment
|
||||
)
|
||||
);
|
||||
|
||||
// reg ex above is not able to remove */ from a single line docblock
|
||||
if (substr($comment, -2) == '*/') {
|
||||
$comment = trim(substr($comment, 0, -2));
|
||||
}
|
||||
|
||||
// normalize strings
|
||||
$comment = str_replace(array("\r\n", "\r"), "\n", $comment);
|
||||
|
||||
return $comment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Splits the DocBlock into a template marker, summary, description and block of tags.
|
||||
*
|
||||
* @param string $comment Comment to split into the sub-parts.
|
||||
*
|
||||
* @author Richard van Velzen (@_richardJ) Special thanks to Richard for the regex responsible for the split.
|
||||
* @author Mike van Riel <me@mikevanriel.com> for extending the regex with template marker support.
|
||||
*
|
||||
* @return string[] containing the template marker (if any), summary, description and a string containing the tags.
|
||||
*/
|
||||
protected function splitDocBlock($comment)
|
||||
{
|
||||
// Performance improvement cheat: if the first character is an @ then only tags are in this DocBlock. This
|
||||
// method does not split tags so we return this verbatim as the fourth result (tags). This saves us the
|
||||
// performance impact of running a regular expression
|
||||
if (strpos($comment, '@') === 0) {
|
||||
return array('', '', '', $comment);
|
||||
}
|
||||
|
||||
// clears all extra horizontal whitespace from the line endings to prevent parsing issues
|
||||
$comment = preg_replace('/\h*$/Sum', '', $comment);
|
||||
|
||||
/*
|
||||
* Splits the docblock into a template marker, short description, long description and tags section
|
||||
*
|
||||
* - The template marker is empty, #@+ or #@- if the DocBlock starts with either of those (a newline may
|
||||
* occur after it and will be stripped).
|
||||
* - The short description is started from the first character until a dot is encountered followed by a
|
||||
* newline OR two consecutive newlines (horizontal whitespace is taken into account to consider spacing
|
||||
* errors). This is optional.
|
||||
* - The long description, any character until a new line is encountered followed by an @ and word
|
||||
* characters (a tag). This is optional.
|
||||
* - Tags; the remaining characters
|
||||
*
|
||||
* Big thanks to RichardJ for contributing this Regular Expression
|
||||
*/
|
||||
preg_match(
|
||||
'/
|
||||
\A
|
||||
# 1. Extract the template marker
|
||||
(?:(\#\@\+|\#\@\-)\n?)?
|
||||
|
||||
# 2. Extract the summary
|
||||
(?:
|
||||
(?! @\pL ) # The summary may not start with an @
|
||||
(
|
||||
[^\n.]+
|
||||
(?:
|
||||
(?! \. \n | \n{2} ) # End summary upon a dot followed by newline or two newlines
|
||||
[\n.] (?! [ \t]* @\pL ) # End summary when an @ is found as first character on a new line
|
||||
[^\n.]+ # Include anything else
|
||||
)*
|
||||
\.?
|
||||
)?
|
||||
)
|
||||
|
||||
# 3. Extract the description
|
||||
(?:
|
||||
\s* # Some form of whitespace _must_ precede a description because a summary must be there
|
||||
(?! @\pL ) # The description may not start with an @
|
||||
(
|
||||
[^\n]+
|
||||
(?: \n+
|
||||
(?! [ \t]* @\pL ) # End description when an @ is found as first character on a new line
|
||||
[^\n]+ # Include anything else
|
||||
)*
|
||||
)
|
||||
)?
|
||||
|
||||
# 4. Extract the tags (anything that follows)
|
||||
(\s+ [\s\S]*)? # everything that follows
|
||||
/ux',
|
||||
$comment,
|
||||
$matches
|
||||
);
|
||||
array_shift($matches);
|
||||
|
||||
while (count($matches) < 4) {
|
||||
$matches[] = '';
|
||||
}
|
||||
|
||||
return $matches;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the tag objects.
|
||||
*
|
||||
* @param string $tags Tag block to parse.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function parseTags($tags)
|
||||
{
|
||||
$result = array();
|
||||
$tags = trim($tags);
|
||||
if ('' !== $tags) {
|
||||
if ('@' !== $tags[0]) {
|
||||
throw new \LogicException(
|
||||
'A tag block started with text instead of an actual tag,'
|
||||
. ' this makes the tag block invalid: ' . $tags
|
||||
);
|
||||
}
|
||||
foreach (explode("\n", $tags) as $tag_line) {
|
||||
if (isset($tag_line[0]) && ($tag_line[0] === '@')) {
|
||||
$result[] = $tag_line;
|
||||
} else {
|
||||
$result[count($result) - 1] .= "\n" . $tag_line;
|
||||
}
|
||||
}
|
||||
|
||||
// create proper Tag objects
|
||||
foreach ($result as $key => $tag_line) {
|
||||
$result[$key] = Tag::createInstance(trim($tag_line), $this);
|
||||
}
|
||||
}
|
||||
|
||||
$this->tags = $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the text portion of the doc block.
|
||||
*
|
||||
* Gets the text portion (short and long description combined) of the doc
|
||||
* block.
|
||||
*
|
||||
* @return string The text portion of the doc block.
|
||||
*/
|
||||
public function getText()
|
||||
{
|
||||
$short = $this->getShortDescription();
|
||||
$long = $this->getLongDescription()->getContents();
|
||||
|
||||
if ($long) {
|
||||
return "{$short}\n\n{$long}";
|
||||
} else {
|
||||
return $short;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the text portion of the doc block.
|
||||
*
|
||||
* Sets the text portion (short and long description combined) of the doc
|
||||
* block.
|
||||
*
|
||||
* @param string $docblock The new text portion of the doc block.
|
||||
*
|
||||
* @return $this This doc block.
|
||||
*/
|
||||
public function setText($comment)
|
||||
{
|
||||
list(,$short, $long) = $this->splitDocBlock($comment);
|
||||
$this->short_description = $short;
|
||||
$this->long_description = new DocBlock\Description($long, $this);
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns the opening line or also known as short description.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getShortDescription()
|
||||
{
|
||||
return $this->short_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the full description or also known as long description.
|
||||
*
|
||||
* @return DocBlock\Description
|
||||
*/
|
||||
public function getLongDescription()
|
||||
{
|
||||
return $this->long_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this DocBlock is the start of a Template section.
|
||||
*
|
||||
* A Docblock may serve as template for a series of subsequent DocBlocks. This is indicated by a special marker
|
||||
* (`#@+`) that is appended directly after the opening `/**` of a DocBlock.
|
||||
*
|
||||
* An example of such an opening is:
|
||||
*
|
||||
* ```
|
||||
* /**#@+
|
||||
* * My DocBlock
|
||||
* * /
|
||||
* ```
|
||||
*
|
||||
* The description and tags (not the summary!) are copied onto all subsequent DocBlocks and also applied to all
|
||||
* elements that follow until another DocBlock is found that contains the closing marker (`#@-`).
|
||||
*
|
||||
* @see self::isTemplateEnd() for the check whether a closing marker was provided.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isTemplateStart()
|
||||
{
|
||||
return $this->isTemplateStart;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this DocBlock is the end of a Template section.
|
||||
*
|
||||
* @see self::isTemplateStart() for a more complete description of the Docblock Template functionality.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isTemplateEnd()
|
||||
{
|
||||
return $this->isTemplateEnd;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current context.
|
||||
*
|
||||
* @return Context
|
||||
*/
|
||||
public function getContext()
|
||||
{
|
||||
return $this->context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current location.
|
||||
*
|
||||
* @return Location
|
||||
*/
|
||||
public function getLocation()
|
||||
{
|
||||
return $this->location;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tags for this DocBlock.
|
||||
*
|
||||
* @return Tag[]
|
||||
*/
|
||||
public function getTags()
|
||||
{
|
||||
return $this->tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of tags matching the given name. If no tags are found
|
||||
* an empty array is returned.
|
||||
*
|
||||
* @param string $name String to search by.
|
||||
*
|
||||
* @return Tag[]
|
||||
*/
|
||||
public function getTagsByName($name)
|
||||
{
|
||||
$result = array();
|
||||
|
||||
/** @var Tag $tag */
|
||||
foreach ($this->getTags() as $tag) {
|
||||
if ($tag->getName() != $name) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$result[] = $tag;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a tag of a certain type is present in this DocBlock.
|
||||
*
|
||||
* @param string $name Tag name to check for.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasTag($name)
|
||||
{
|
||||
/** @var Tag $tag */
|
||||
foreach ($this->getTags() as $tag) {
|
||||
if ($tag->getName() == $name) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends a tag at the end of the list of tags.
|
||||
*
|
||||
* @param Tag $tag The tag to add.
|
||||
*
|
||||
* @return Tag The newly added tag.
|
||||
*
|
||||
* @throws \LogicException When the tag belongs to a different DocBlock.
|
||||
*/
|
||||
public function appendTag(Tag $tag)
|
||||
{
|
||||
if (null === $tag->getDocBlock()) {
|
||||
$tag->setDocBlock($this);
|
||||
}
|
||||
|
||||
if ($tag->getDocBlock() === $this) {
|
||||
$this->tags[] = $tag;
|
||||
} else {
|
||||
throw new \LogicException(
|
||||
'This tag belongs to a different DocBlock object.'
|
||||
);
|
||||
}
|
||||
|
||||
return $tag;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Builds a string representation of this object.
|
||||
*
|
||||
* @todo determine the exact format as used by PHP Reflection and
|
||||
* implement it.
|
||||
*
|
||||
* @return string
|
||||
* @codeCoverageIgnore Not yet implemented
|
||||
*/
|
||||
public static function export()
|
||||
{
|
||||
throw new \Exception('Not yet implemented');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the exported information (we should use the export static method
|
||||
* BUT this throws an exception at this point).
|
||||
*
|
||||
* @return string
|
||||
* @codeCoverageIgnore Not yet implemented
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return 'Not yet implemented';
|
||||
}
|
||||
}
|
@@ -1,154 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Vasil Rangelov <boen.robot@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock;
|
||||
|
||||
/**
|
||||
* The context in which a DocBlock occurs.
|
||||
*
|
||||
* @author Vasil Rangelov <boen.robot@gmail.com>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class Context
|
||||
{
|
||||
/** @var string The current namespace. */
|
||||
protected $namespace = '';
|
||||
|
||||
/** @var array List of namespace aliases => Fully Qualified Namespace. */
|
||||
protected $namespace_aliases = array();
|
||||
|
||||
/** @var string Name of the structural element, within the namespace. */
|
||||
protected $lsen = '';
|
||||
|
||||
/**
|
||||
* Cteates a new context.
|
||||
* @param string $namespace The namespace where this DocBlock
|
||||
* resides in.
|
||||
* @param array $namespace_aliases List of namespace aliases => Fully
|
||||
* Qualified Namespace.
|
||||
* @param string $lsen Name of the structural element, within
|
||||
* the namespace.
|
||||
*/
|
||||
public function __construct(
|
||||
$namespace = '',
|
||||
array $namespace_aliases = array(),
|
||||
$lsen = ''
|
||||
) {
|
||||
if (!empty($namespace)) {
|
||||
$this->setNamespace($namespace);
|
||||
}
|
||||
$this->setNamespaceAliases($namespace_aliases);
|
||||
$this->setLSEN($lsen);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string The namespace where this DocBlock resides in.
|
||||
*/
|
||||
public function getNamespace()
|
||||
{
|
||||
return $this->namespace;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array List of namespace aliases => Fully Qualified Namespace.
|
||||
*/
|
||||
public function getNamespaceAliases()
|
||||
{
|
||||
return $this->namespace_aliases;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Local Structural Element Name.
|
||||
*
|
||||
* @return string Name of the structural element, within the namespace.
|
||||
*/
|
||||
public function getLSEN()
|
||||
{
|
||||
return $this->lsen;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a new namespace.
|
||||
*
|
||||
* Sets a new namespace for the context. Leading and trailing slashes are
|
||||
* trimmed, and the keywords "global" and "default" are treated as aliases
|
||||
* to no namespace.
|
||||
*
|
||||
* @param string $namespace The new namespace to set.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setNamespace($namespace)
|
||||
{
|
||||
if ('global' !== $namespace
|
||||
&& 'default' !== $namespace
|
||||
) {
|
||||
// Srip leading and trailing slash
|
||||
$this->namespace = trim((string)$namespace, '\\');
|
||||
} else {
|
||||
$this->namespace = '';
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the namespace aliases, replacing all previous ones.
|
||||
*
|
||||
* @param array $namespace_aliases List of namespace aliases => Fully
|
||||
* Qualified Namespace.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setNamespaceAliases(array $namespace_aliases)
|
||||
{
|
||||
$this->namespace_aliases = array();
|
||||
foreach ($namespace_aliases as $alias => $fqnn) {
|
||||
$this->setNamespaceAlias($alias, $fqnn);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a namespace alias to the context.
|
||||
*
|
||||
* @param string $alias The alias name (the part after "as", or the last
|
||||
* part of the Fully Qualified Namespace Name) to add.
|
||||
* @param string $fqnn The Fully Qualified Namespace Name for this alias.
|
||||
* Any form of leading/trailing slashes are accepted, but what will be
|
||||
* stored is a name, prefixed with a slash, and no trailing slash.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setNamespaceAlias($alias, $fqnn)
|
||||
{
|
||||
$this->namespace_aliases[$alias] = '\\' . trim((string)$fqnn, '\\');
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a new Local Structural Element Name.
|
||||
*
|
||||
* Sets a new Local Structural Element Name. A local name also contains
|
||||
* punctuation determining the kind of structural element (e.g. trailing "("
|
||||
* and ")" for functions and methods).
|
||||
*
|
||||
* @param string $lsen The new local name of a structural element.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setLSEN($lsen)
|
||||
{
|
||||
$this->lsen = (string)$lsen;
|
||||
return $this;
|
||||
}
|
||||
}
|
@@ -1,223 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock;
|
||||
|
||||
/**
|
||||
* Parses a Description of a DocBlock or tag.
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class Description implements \Reflector
|
||||
{
|
||||
/** @var string */
|
||||
protected $contents = '';
|
||||
|
||||
/** @var array The contents, as an array of strings and Tag objects. */
|
||||
protected $parsedContents = null;
|
||||
|
||||
/** @var DocBlock The DocBlock which this description belongs to. */
|
||||
protected $docblock = null;
|
||||
|
||||
/**
|
||||
* Populates the fields of a description.
|
||||
*
|
||||
* @param string $content The description's conetnts.
|
||||
* @param DocBlock $docblock The DocBlock which this description belongs to.
|
||||
*/
|
||||
public function __construct($content, DocBlock $docblock = null)
|
||||
{
|
||||
$this->setContent($content)->setDocBlock($docblock);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the text of this description.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getContents()
|
||||
{
|
||||
return $this->contents;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the text of this description.
|
||||
*
|
||||
* @param string $content The new text of this description.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setContent($content)
|
||||
{
|
||||
$this->contents = trim($content);
|
||||
|
||||
$this->parsedContents = null;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the parsed text of this description.
|
||||
*
|
||||
* @return array An array of strings and tag objects, in the order they
|
||||
* occur within the description.
|
||||
*/
|
||||
public function getParsedContents()
|
||||
{
|
||||
if (null === $this->parsedContents) {
|
||||
$this->parsedContents = preg_split(
|
||||
'/\{
|
||||
# "{@}" is not a valid inline tag. This ensures that
|
||||
# we do not treat it as one, but treat it literally.
|
||||
(?!@\})
|
||||
# We want to capture the whole tag line, but without the
|
||||
# inline tag delimiters.
|
||||
(\@
|
||||
# Match everything up to the next delimiter.
|
||||
[^{}]*
|
||||
# Nested inline tag content should not be captured, or
|
||||
# it will appear in the result separately.
|
||||
(?:
|
||||
# Match nested inline tags.
|
||||
(?:
|
||||
# Because we did not catch the tag delimiters
|
||||
# earlier, we must be explicit with them here.
|
||||
# Notice that this also matches "{}", as a way
|
||||
# to later introduce it as an escape sequence.
|
||||
\{(?1)?\}
|
||||
|
|
||||
# Make sure we match hanging "{".
|
||||
\{
|
||||
)
|
||||
# Match content after the nested inline tag.
|
||||
[^{}]*
|
||||
)* # If there are more inline tags, match them as well.
|
||||
# We use "*" since there may not be any nested inline
|
||||
# tags.
|
||||
)
|
||||
\}/Sux',
|
||||
$this->contents,
|
||||
null,
|
||||
PREG_SPLIT_DELIM_CAPTURE
|
||||
);
|
||||
|
||||
$count = count($this->parsedContents);
|
||||
for ($i=1; $i<$count; $i += 2) {
|
||||
$this->parsedContents[$i] = Tag::createInstance(
|
||||
$this->parsedContents[$i],
|
||||
$this->docblock
|
||||
);
|
||||
}
|
||||
|
||||
//In order to allow "literal" inline tags, the otherwise invalid
|
||||
//sequence "{@}" is changed to "@", and "{}" is changed to "}".
|
||||
//See unit tests for examples.
|
||||
for ($i=0; $i<$count; $i += 2) {
|
||||
$this->parsedContents[$i] = str_replace(
|
||||
array('{@}', '{}'),
|
||||
array('@', '}'),
|
||||
$this->parsedContents[$i]
|
||||
);
|
||||
}
|
||||
}
|
||||
return $this->parsedContents;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a formatted variant of the Long Description using MarkDown.
|
||||
*
|
||||
* @todo this should become a more intelligent piece of code where the
|
||||
* configuration contains a setting what format long descriptions are.
|
||||
*
|
||||
* @codeCoverageIgnore Will be removed soon, in favor of adapters at
|
||||
* PhpDocumentor itself that will process text in various formats.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFormattedContents()
|
||||
{
|
||||
$result = $this->contents;
|
||||
|
||||
// if the long description contains a plain HTML <code> element, surround
|
||||
// it with a pre element. Please note that we explicitly used str_replace
|
||||
// and not preg_replace to gain performance
|
||||
if (strpos($result, '<code>') !== false) {
|
||||
$result = str_replace(
|
||||
array('<code>', "<code>\r\n", "<code>\n", "<code>\r", '</code>'),
|
||||
array('<pre><code>', '<code>', '<code>', '<code>', '</code></pre>'),
|
||||
$result
|
||||
);
|
||||
}
|
||||
|
||||
if (class_exists('Parsedown')) {
|
||||
$markdown = \Parsedown::instance();
|
||||
$result = $markdown->parse($result);
|
||||
} elseif (class_exists('dflydev\markdown\MarkdownExtraParser')) {
|
||||
$markdown = new \dflydev\markdown\MarkdownExtraParser();
|
||||
$result = $markdown->transformMarkdown($result);
|
||||
}
|
||||
|
||||
return trim($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the docblock this tag belongs to.
|
||||
*
|
||||
* @return DocBlock The docblock this description belongs to.
|
||||
*/
|
||||
public function getDocBlock()
|
||||
{
|
||||
return $this->docblock;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the docblock this tag belongs to.
|
||||
*
|
||||
* @param DocBlock $docblock The new docblock this description belongs to.
|
||||
* Setting NULL removes any association.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setDocBlock(DocBlock $docblock = null)
|
||||
{
|
||||
$this->docblock = $docblock;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a string representation of this object.
|
||||
*
|
||||
* @todo determine the exact format as used by PHP Reflection
|
||||
* and implement it.
|
||||
*
|
||||
* @return void
|
||||
* @codeCoverageIgnore Not yet implemented
|
||||
*/
|
||||
public static function export()
|
||||
{
|
||||
throw new \Exception('Not yet implemented');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the long description as a string.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->getContents();
|
||||
}
|
||||
}
|
@@ -1,76 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Vasil Rangelov <boen.robot@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock;
|
||||
|
||||
/**
|
||||
* The location a DocBlock occurs within a file.
|
||||
*
|
||||
* @author Vasil Rangelov <boen.robot@gmail.com>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class Location
|
||||
{
|
||||
/** @var int Line where the DocBlock text starts. */
|
||||
protected $lineNumber = 0;
|
||||
|
||||
/** @var int Column where the DocBlock text starts. */
|
||||
protected $columnNumber = 0;
|
||||
|
||||
public function __construct(
|
||||
$lineNumber = 0,
|
||||
$columnNumber = 0
|
||||
) {
|
||||
$this->setLineNumber($lineNumber)->setColumnNumber($columnNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int Line where the DocBlock text starts.
|
||||
*/
|
||||
public function getLineNumber()
|
||||
{
|
||||
return $this->lineNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type $lineNumber
|
||||
* @return $this
|
||||
*/
|
||||
public function setLineNumber($lineNumber)
|
||||
{
|
||||
$this->lineNumber = (int)$lineNumber;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int Column where the DocBlock text starts.
|
||||
*/
|
||||
public function getColumnNumber()
|
||||
{
|
||||
return $this->columnNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param int $columnNumber
|
||||
* @return $this
|
||||
*/
|
||||
public function setColumnNumber($columnNumber)
|
||||
{
|
||||
$this->columnNumber = (int)$columnNumber;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
@@ -1,198 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Barry vd. Heuvel <barryvdh@gmail.com>
|
||||
* @copyright 2013 Mike van Riel / Naenius (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock;
|
||||
|
||||
/**
|
||||
* Serializes a DocBlock instance.
|
||||
*
|
||||
* @author Barry vd. Heuvel <barryvdh@gmail.com>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class Serializer
|
||||
{
|
||||
|
||||
/** @var string The string to indent the comment with. */
|
||||
protected $indentString = ' ';
|
||||
|
||||
/** @var int The number of times the indent string is repeated. */
|
||||
protected $indent = 0;
|
||||
|
||||
/** @var bool Whether to indent the first line. */
|
||||
protected $isFirstLineIndented = true;
|
||||
|
||||
/** @var int|null The max length of a line. */
|
||||
protected $lineLength = null;
|
||||
|
||||
/**
|
||||
* Create a Serializer instance.
|
||||
*
|
||||
* @param int $indent The number of times the indent string is
|
||||
* repeated.
|
||||
* @param string $indentString The string to indent the comment with.
|
||||
* @param bool $indentFirstLine Whether to indent the first line.
|
||||
* @param int|null $lineLength The max length of a line or NULL to
|
||||
* disable line wrapping.
|
||||
*/
|
||||
public function __construct(
|
||||
$indent = 0,
|
||||
$indentString = ' ',
|
||||
$indentFirstLine = true,
|
||||
$lineLength = null
|
||||
) {
|
||||
$this->setIndentationString($indentString);
|
||||
$this->setIndent($indent);
|
||||
$this->setIsFirstLineIndented($indentFirstLine);
|
||||
$this->setLineLength($lineLength);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the string to indent comments with.
|
||||
*
|
||||
* @param string $indentationString The string to indent comments with.
|
||||
*
|
||||
* @return $this This serializer object.
|
||||
*/
|
||||
public function setIndentationString($indentString)
|
||||
{
|
||||
$this->indentString = (string)$indentString;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string to indent comments with.
|
||||
*
|
||||
* @return string The indent string.
|
||||
*/
|
||||
public function getIndentationString()
|
||||
{
|
||||
return $this->indentString;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the number of indents.
|
||||
*
|
||||
* @param int $indent The number of times the indent string is repeated.
|
||||
*
|
||||
* @return $this This serializer object.
|
||||
*/
|
||||
public function setIndent($indent)
|
||||
{
|
||||
$this->indent = (int)$indent;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the number of indents.
|
||||
*
|
||||
* @return int The number of times the indent string is repeated.
|
||||
*/
|
||||
public function getIndent()
|
||||
{
|
||||
return $this->indent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether or not the first line should be indented.
|
||||
*
|
||||
* Sets whether or not the first line (the one with the "/**") should be
|
||||
* indented.
|
||||
*
|
||||
* @param bool $indentFirstLine The new value for this setting.
|
||||
*
|
||||
* @return $this This serializer object.
|
||||
*/
|
||||
public function setIsFirstLineIndented($indentFirstLine)
|
||||
{
|
||||
$this->isFirstLineIndented = (bool)$indentFirstLine;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets whether or not the first line should be indented.
|
||||
*
|
||||
* @return bool Whether or not the first line should be indented.
|
||||
*/
|
||||
public function isFirstLineIndented()
|
||||
{
|
||||
return $this->isFirstLineIndented;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the line length.
|
||||
*
|
||||
* Sets the length of each line in the serialization. Content will be
|
||||
* wrapped within this limit.
|
||||
*
|
||||
* @param int|null $lineLength The length of each line. NULL to disable line
|
||||
* wrapping altogether.
|
||||
*
|
||||
* @return $this This serializer object.
|
||||
*/
|
||||
public function setLineLength($lineLength)
|
||||
{
|
||||
$this->lineLength = null === $lineLength ? null : (int)$lineLength;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the line length.
|
||||
*
|
||||
* @return int|null The length of each line or NULL if line wrapping is
|
||||
* disabled.
|
||||
*/
|
||||
public function getLineLength()
|
||||
{
|
||||
return $this->lineLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a DocBlock comment.
|
||||
*
|
||||
* @param DocBlock The DocBlock to serialize.
|
||||
*
|
||||
* @return string The serialized doc block.
|
||||
*/
|
||||
public function getDocComment(DocBlock $docblock)
|
||||
{
|
||||
$indent = str_repeat($this->indentString, $this->indent);
|
||||
$firstIndent = $this->isFirstLineIndented ? $indent : '';
|
||||
|
||||
$text = $docblock->getText();
|
||||
if ($this->lineLength) {
|
||||
//3 === strlen(' * ')
|
||||
$wrapLength = $this->lineLength - strlen($indent) - 3;
|
||||
$text = wordwrap($text, $wrapLength);
|
||||
}
|
||||
$text = str_replace("\n", "\n{$indent} * ", $text);
|
||||
|
||||
$comment = "{$firstIndent}/**\n{$indent} * {$text}\n{$indent} *\n";
|
||||
|
||||
/** @var Tag $tag */
|
||||
foreach ($docblock->getTags() as $tag) {
|
||||
$tagText = (string) $tag;
|
||||
if ($this->lineLength) {
|
||||
$tagText = wordwrap($tagText, $wrapLength);
|
||||
}
|
||||
$tagText = str_replace("\n", "\n{$indent} * ", $tagText);
|
||||
|
||||
$comment .= "{$indent} * {$tagText}\n";
|
||||
}
|
||||
|
||||
$comment .= $indent . ' */';
|
||||
|
||||
return $comment;
|
||||
}
|
||||
}
|
@@ -1,377 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock;
|
||||
|
||||
/**
|
||||
* Parses a tag definition for a DocBlock.
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class Tag implements \Reflector
|
||||
{
|
||||
/**
|
||||
* PCRE regular expression matching a tag name.
|
||||
*/
|
||||
const REGEX_TAGNAME = '[\w\-\_\\\\]+';
|
||||
|
||||
/** @var string Name of the tag */
|
||||
protected $tag = '';
|
||||
|
||||
/**
|
||||
* @var string|null Content of the tag.
|
||||
* When set to NULL, it means it needs to be regenerated.
|
||||
*/
|
||||
protected $content = '';
|
||||
|
||||
/** @var string Description of the content of this tag */
|
||||
protected $description = '';
|
||||
|
||||
/**
|
||||
* @var array|null The description, as an array of strings and Tag objects.
|
||||
* When set to NULL, it means it needs to be regenerated.
|
||||
*/
|
||||
protected $parsedDescription = null;
|
||||
|
||||
/** @var Location Location of the tag. */
|
||||
protected $location = null;
|
||||
|
||||
/** @var DocBlock The DocBlock which this tag belongs to. */
|
||||
protected $docblock = null;
|
||||
|
||||
/**
|
||||
* @var array An array with a tag as a key, and an FQCN to a class that
|
||||
* handles it as an array value. The class is expected to inherit this
|
||||
* class.
|
||||
*/
|
||||
private static $tagHandlerMappings = array(
|
||||
'author'
|
||||
=> '\phpDocumentor\Reflection\DocBlock\Tag\AuthorTag',
|
||||
'covers'
|
||||
=> '\phpDocumentor\Reflection\DocBlock\Tag\CoversTag',
|
||||
'deprecated'
|
||||
=> '\phpDocumentor\Reflection\DocBlock\Tag\DeprecatedTag',
|
||||
'example'
|
||||
=> '\phpDocumentor\Reflection\DocBlock\Tag\ExampleTag',
|
||||
'link'
|
||||
=> '\phpDocumentor\Reflection\DocBlock\Tag\LinkTag',
|
||||
'method'
|
||||
=> '\phpDocumentor\Reflection\DocBlock\Tag\MethodTag',
|
||||
'param'
|
||||
=> '\phpDocumentor\Reflection\DocBlock\Tag\ParamTag',
|
||||
'property-read'
|
||||
=> '\phpDocumentor\Reflection\DocBlock\Tag\PropertyReadTag',
|
||||
'property'
|
||||
=> '\phpDocumentor\Reflection\DocBlock\Tag\PropertyTag',
|
||||
'property-write'
|
||||
=> '\phpDocumentor\Reflection\DocBlock\Tag\PropertyWriteTag',
|
||||
'return'
|
||||
=> '\phpDocumentor\Reflection\DocBlock\Tag\ReturnTag',
|
||||
'see'
|
||||
=> '\phpDocumentor\Reflection\DocBlock\Tag\SeeTag',
|
||||
'since'
|
||||
=> '\phpDocumentor\Reflection\DocBlock\Tag\SinceTag',
|
||||
'source'
|
||||
=> '\phpDocumentor\Reflection\DocBlock\Tag\SourceTag',
|
||||
'throw'
|
||||
=> '\phpDocumentor\Reflection\DocBlock\Tag\ThrowsTag',
|
||||
'throws'
|
||||
=> '\phpDocumentor\Reflection\DocBlock\Tag\ThrowsTag',
|
||||
'uses'
|
||||
=> '\phpDocumentor\Reflection\DocBlock\Tag\UsesTag',
|
||||
'var'
|
||||
=> '\phpDocumentor\Reflection\DocBlock\Tag\VarTag',
|
||||
'version'
|
||||
=> '\phpDocumentor\Reflection\DocBlock\Tag\VersionTag'
|
||||
);
|
||||
|
||||
/**
|
||||
* Factory method responsible for instantiating the correct sub type.
|
||||
*
|
||||
* @param string $tag_line The text for this tag, including description.
|
||||
* @param DocBlock $docblock The DocBlock which this tag belongs to.
|
||||
* @param Location $location Location of the tag.
|
||||
*
|
||||
* @throws \InvalidArgumentException if an invalid tag line was presented.
|
||||
*
|
||||
* @return static A new tag object.
|
||||
*/
|
||||
final public static function createInstance(
|
||||
$tag_line,
|
||||
DocBlock $docblock = null,
|
||||
Location $location = null
|
||||
) {
|
||||
if (!preg_match(
|
||||
'/^@(' . self::REGEX_TAGNAME . ')(?:\s*([^\s].*)|$)?/us',
|
||||
$tag_line,
|
||||
$matches
|
||||
)) {
|
||||
throw new \InvalidArgumentException(
|
||||
'Invalid tag_line detected: ' . $tag_line
|
||||
);
|
||||
}
|
||||
|
||||
$handler = __CLASS__;
|
||||
if (isset(self::$tagHandlerMappings[$matches[1]])) {
|
||||
$handler = self::$tagHandlerMappings[$matches[1]];
|
||||
} elseif (isset($docblock)) {
|
||||
$tagName = (string)new Type\Collection(
|
||||
array($matches[1]),
|
||||
$docblock->getContext()
|
||||
);
|
||||
|
||||
if (isset(self::$tagHandlerMappings[$tagName])) {
|
||||
$handler = self::$tagHandlerMappings[$tagName];
|
||||
}
|
||||
}
|
||||
|
||||
return new $handler(
|
||||
$matches[1],
|
||||
isset($matches[2]) ? $matches[2] : '',
|
||||
$docblock,
|
||||
$location
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a handler for tags.
|
||||
*
|
||||
* Registers a handler for tags. The class specified is autoloaded if it's
|
||||
* not available. It must inherit from this class.
|
||||
*
|
||||
* @param string $tag Name of tag to regiser a handler for. When
|
||||
* registering a namespaced tag, the full name, along with a prefixing
|
||||
* slash MUST be provided.
|
||||
* @param string|null $handler FQCN of handler. Specifing NULL removes the
|
||||
* handler for the specified tag, if any.
|
||||
*
|
||||
* @return bool TRUE on success, FALSE on failure.
|
||||
*/
|
||||
final public static function registerTagHandler($tag, $handler)
|
||||
{
|
||||
$tag = trim((string)$tag);
|
||||
|
||||
if (null === $handler) {
|
||||
unset(self::$tagHandlerMappings[$tag]);
|
||||
return true;
|
||||
}
|
||||
|
||||
if ('' !== $tag
|
||||
&& class_exists($handler, true)
|
||||
&& is_subclass_of($handler, __CLASS__)
|
||||
&& !strpos($tag, '\\') //Accept no slash, and 1st slash at offset 0.
|
||||
) {
|
||||
self::$tagHandlerMappings[$tag] = $handler;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a tag and populates the member variables.
|
||||
*
|
||||
* @param string $name Name of the tag.
|
||||
* @param string $content The contents of the given tag.
|
||||
* @param DocBlock $docblock The DocBlock which this tag belongs to.
|
||||
* @param Location $location Location of the tag.
|
||||
*/
|
||||
public function __construct(
|
||||
$name,
|
||||
$content,
|
||||
DocBlock $docblock = null,
|
||||
Location $location = null
|
||||
) {
|
||||
$this
|
||||
->setName($name)
|
||||
->setContent($content)
|
||||
->setDocBlock($docblock)
|
||||
->setLocation($location);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name of this tag.
|
||||
*
|
||||
* @return string The name of this tag.
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->tag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the name of this tag.
|
||||
*
|
||||
* @param string $name The new name of this tag.
|
||||
*
|
||||
* @return $this
|
||||
* @throws \InvalidArgumentException When an invalid tag name is provided.
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
if (!preg_match('/^' . self::REGEX_TAGNAME . '$/u', $name)) {
|
||||
throw new \InvalidArgumentException(
|
||||
'Invalid tag name supplied: ' . $name
|
||||
);
|
||||
}
|
||||
|
||||
$this->tag = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the content of this tag.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getContent()
|
||||
{
|
||||
if (null === $this->content) {
|
||||
$this->content = $this->description;
|
||||
}
|
||||
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the content of this tag.
|
||||
*
|
||||
* @param string $content The new content of this tag.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setContent($content)
|
||||
{
|
||||
$this->setDescription($content);
|
||||
$this->content = $content;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the description component of this tag.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the description component of this tag.
|
||||
*
|
||||
* @param string $description The new description component of this tag.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setDescription($description)
|
||||
{
|
||||
$this->content = null;
|
||||
$this->parsedDescription = null;
|
||||
$this->description = trim($description);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the parsed text of this description.
|
||||
*
|
||||
* @return array An array of strings and tag objects, in the order they
|
||||
* occur within the description.
|
||||
*/
|
||||
public function getParsedDescription()
|
||||
{
|
||||
if (null === $this->parsedDescription) {
|
||||
$description = new Description($this->description, $this->docblock);
|
||||
$this->parsedDescription = $description->getParsedContents();
|
||||
}
|
||||
return $this->parsedDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the docblock this tag belongs to.
|
||||
*
|
||||
* @return DocBlock The docblock this tag belongs to.
|
||||
*/
|
||||
public function getDocBlock()
|
||||
{
|
||||
return $this->docblock;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the docblock this tag belongs to.
|
||||
*
|
||||
* @param DocBlock $docblock The new docblock this tag belongs to. Setting
|
||||
* NULL removes any association.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setDocBlock(DocBlock $docblock = null)
|
||||
{
|
||||
$this->docblock = $docblock;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the location of the tag.
|
||||
*
|
||||
* @return Location The tag's location.
|
||||
*/
|
||||
public function getLocation()
|
||||
{
|
||||
return $this->location;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the location of the tag.
|
||||
*
|
||||
* @param Location $location The new location of the tag.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setLocation(Location $location = null)
|
||||
{
|
||||
$this->location = $location;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a string representation of this object.
|
||||
*
|
||||
* @todo determine the exact format as used by PHP Reflection and implement it.
|
||||
*
|
||||
* @return void
|
||||
* @codeCoverageIgnore Not yet implemented
|
||||
*/
|
||||
public static function export()
|
||||
{
|
||||
throw new \Exception('Not yet implemented');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tag as a serialized string
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return "@{$this->getName()} {$this->getContent()}";
|
||||
}
|
||||
}
|
@@ -1,131 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Vasil Rangelov <boen.robot@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
/**
|
||||
* Reflection class for an @author tag in a Docblock.
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class AuthorTag extends Tag
|
||||
{
|
||||
/**
|
||||
* PCRE regular expression matching any valid value for the name component.
|
||||
*/
|
||||
const REGEX_AUTHOR_NAME = '[^\<]*';
|
||||
|
||||
/**
|
||||
* PCRE regular expression matching any valid value for the email component.
|
||||
*/
|
||||
const REGEX_AUTHOR_EMAIL = '[^\>]*';
|
||||
|
||||
/** @var string The name of the author */
|
||||
protected $authorName = '';
|
||||
|
||||
/** @var string The email of the author */
|
||||
protected $authorEmail = '';
|
||||
|
||||
public function getContent()
|
||||
{
|
||||
if (null === $this->content) {
|
||||
$this->content = $this->authorName;
|
||||
if ('' != $this->authorEmail) {
|
||||
$this->content .= "<{$this->authorEmail}>";
|
||||
}
|
||||
}
|
||||
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setContent($content)
|
||||
{
|
||||
parent::setContent($content);
|
||||
if (preg_match(
|
||||
'/^(' . self::REGEX_AUTHOR_NAME .
|
||||
')(\<(' . self::REGEX_AUTHOR_EMAIL .
|
||||
')\>)?$/u',
|
||||
$this->description,
|
||||
$matches
|
||||
)) {
|
||||
$this->authorName = trim($matches[1]);
|
||||
if (isset($matches[3])) {
|
||||
$this->authorEmail = trim($matches[3]);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the author's name.
|
||||
*
|
||||
* @return string The author's name.
|
||||
*/
|
||||
public function getAuthorName()
|
||||
{
|
||||
return $this->authorName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the author's name.
|
||||
*
|
||||
* @param string $authorName The new author name.
|
||||
* An invalid value will set an empty string.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setAuthorName($authorName)
|
||||
{
|
||||
$this->content = null;
|
||||
$this->authorName
|
||||
= preg_match('/^' . self::REGEX_AUTHOR_NAME . '$/u', $authorName)
|
||||
? $authorName : '';
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the author's email.
|
||||
*
|
||||
* @return string The author's email.
|
||||
*/
|
||||
public function getAuthorEmail()
|
||||
{
|
||||
return $this->authorEmail;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the author's email.
|
||||
*
|
||||
* @param string $authorEmail The new author email.
|
||||
* An invalid value will set an empty string.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setAuthorEmail($authorEmail)
|
||||
{
|
||||
$this->authorEmail
|
||||
= preg_match('/^' . self::REGEX_AUTHOR_EMAIL . '$/u', $authorEmail)
|
||||
? $authorEmail : '';
|
||||
|
||||
$this->content = null;
|
||||
return $this;
|
||||
}
|
||||
}
|
@@ -1,24 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
/**
|
||||
* Reflection class for a @covers tag in a Docblock.
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class CoversTag extends SeeTag
|
||||
{
|
||||
}
|
@@ -1,26 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Vasil Rangelov <boen.robot@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Tag\VersionTag;
|
||||
|
||||
/**
|
||||
* Reflection class for a @deprecated tag in a Docblock.
|
||||
*
|
||||
* @author Vasil Rangelov <boen.robot@gmail.com>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class DeprecatedTag extends VersionTag
|
||||
{
|
||||
}
|
@@ -1,156 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Vasil Rangelov <boen.robot@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
/**
|
||||
* Reflection class for a @example tag in a Docblock.
|
||||
*
|
||||
* @author Vasil Rangelov <boen.robot@gmail.com>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class ExampleTag extends SourceTag
|
||||
{
|
||||
/**
|
||||
* @var string Path to a file to use as an example.
|
||||
* May also be an absolute URI.
|
||||
*/
|
||||
protected $filePath = '';
|
||||
|
||||
/**
|
||||
* @var bool Whether the file path component represents an URI.
|
||||
* This determines how the file portion appears at {@link getContent()}.
|
||||
*/
|
||||
protected $isURI = false;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getContent()
|
||||
{
|
||||
if (null === $this->content) {
|
||||
$filePath = '';
|
||||
if ($this->isURI) {
|
||||
if (false === strpos($this->filePath, ':')) {
|
||||
$filePath = str_replace(
|
||||
'%2F',
|
||||
'/',
|
||||
rawurlencode($this->filePath)
|
||||
);
|
||||
} else {
|
||||
$filePath = $this->filePath;
|
||||
}
|
||||
} else {
|
||||
$filePath = '"' . $this->filePath . '"';
|
||||
}
|
||||
|
||||
$this->content = $filePath . ' ' . parent::getContent();
|
||||
}
|
||||
|
||||
return $this->content;
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setContent($content)
|
||||
{
|
||||
Tag::setContent($content);
|
||||
if (preg_match(
|
||||
'/^
|
||||
# File component
|
||||
(?:
|
||||
# File path in quotes
|
||||
\"([^\"]+)\"
|
||||
|
|
||||
# File URI
|
||||
(\S+)
|
||||
)
|
||||
# Remaining content (parsed by SourceTag)
|
||||
(?:\s+(.*))?
|
||||
$/sux',
|
||||
$this->description,
|
||||
$matches
|
||||
)) {
|
||||
if ('' !== $matches[1]) {
|
||||
$this->setFilePath($matches[1]);
|
||||
} else {
|
||||
$this->setFileURI($matches[2]);
|
||||
}
|
||||
|
||||
if (isset($matches[3])) {
|
||||
parent::setContent($matches[3]);
|
||||
} else {
|
||||
$this->setDescription('');
|
||||
}
|
||||
$this->content = $content;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the file path.
|
||||
*
|
||||
* @return string Path to a file to use as an example.
|
||||
* May also be an absolute URI.
|
||||
*/
|
||||
public function getFilePath()
|
||||
{
|
||||
return $this->filePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the file path.
|
||||
*
|
||||
* @param string $filePath The new file path to use for the example.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setFilePath($filePath)
|
||||
{
|
||||
$this->isURI = false;
|
||||
$this->filePath = trim($filePath);
|
||||
|
||||
$this->content = null;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the file path as an URI.
|
||||
*
|
||||
* This function is equivalent to {@link setFilePath()}, except that it
|
||||
* convers an URI to a file path before that.
|
||||
*
|
||||
* There is no getFileURI(), as {@link getFilePath()} is compatible.
|
||||
*
|
||||
* @param type $uri The new file URI to use as an example.
|
||||
*/
|
||||
public function setFileURI($uri)
|
||||
{
|
||||
$this->isURI = true;
|
||||
if (false === strpos($uri, ':')) {
|
||||
//Relative URL
|
||||
$this->filePath = rawurldecode(
|
||||
str_replace(array('/', '\\'), '%2F', $uri)
|
||||
);
|
||||
} else {
|
||||
//Absolute URL or URI.
|
||||
$this->filePath = $uri;
|
||||
}
|
||||
|
||||
$this->content = null;
|
||||
return $this;
|
||||
}
|
||||
}
|
@@ -1,81 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Ben Selby <benmatselby@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
/**
|
||||
* Reflection class for a @link tag in a Docblock.
|
||||
*
|
||||
* @author Ben Selby <benmatselby@gmail.com>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class LinkTag extends Tag
|
||||
{
|
||||
/** @var string */
|
||||
protected $link = '';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getContent()
|
||||
{
|
||||
if (null === $this->content) {
|
||||
$this->content = "{$this->link} {$this->description}";
|
||||
}
|
||||
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setContent($content)
|
||||
{
|
||||
parent::setContent($content);
|
||||
$parts = preg_split('/\s+/Su', $this->description, 2);
|
||||
|
||||
$this->link = $parts[0];
|
||||
|
||||
$this->setDescription(isset($parts[1]) ? $parts[1] : $parts[0]);
|
||||
|
||||
$this->content = $content;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the link
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLink()
|
||||
{
|
||||
return $this->link;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the link
|
||||
*
|
||||
* @param string $link The link
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setLink($link)
|
||||
{
|
||||
$this->link = $link;
|
||||
|
||||
$this->content = null;
|
||||
return $this;
|
||||
}
|
||||
}
|
@@ -1,209 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
/**
|
||||
* Reflection class for a @method in a Docblock.
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class MethodTag extends ReturnTag
|
||||
{
|
||||
|
||||
/** @var string */
|
||||
protected $method_name = '';
|
||||
|
||||
/** @var string */
|
||||
protected $arguments = '';
|
||||
|
||||
/** @var bool */
|
||||
protected $isStatic = false;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getContent()
|
||||
{
|
||||
if (null === $this->content) {
|
||||
$this->content = '';
|
||||
if ($this->isStatic) {
|
||||
$this->content .= 'static ';
|
||||
}
|
||||
$this->content .= $this->type .
|
||||
" {$this->method_name}({$this->arguments}) " .
|
||||
$this->description;
|
||||
}
|
||||
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setContent($content)
|
||||
{
|
||||
Tag::setContent($content);
|
||||
// 1. none or more whitespace
|
||||
// 2. optionally the keyword "static" followed by whitespace
|
||||
// 3. optionally a word with underscores followed by whitespace : as
|
||||
// type for the return value
|
||||
// 4. then optionally a word with underscores followed by () and
|
||||
// whitespace : as method name as used by phpDocumentor
|
||||
// 5. then a word with underscores, followed by ( and any character
|
||||
// until a ) and whitespace : as method name with signature
|
||||
// 6. any remaining text : as description
|
||||
if (preg_match(
|
||||
'/^
|
||||
# Static keyword
|
||||
# Declates a static method ONLY if type is also present
|
||||
(?:
|
||||
(static)
|
||||
\s+
|
||||
)?
|
||||
# Return type
|
||||
(?:
|
||||
([\w\|_\\\\]+)
|
||||
\s+
|
||||
)?
|
||||
# Legacy method name (not captured)
|
||||
(?:
|
||||
[\w_]+\(\)\s+
|
||||
)?
|
||||
# Method name
|
||||
([\w\|_\\\\]+)
|
||||
# Arguments
|
||||
\(([^\)]*)\)
|
||||
\s*
|
||||
# Description
|
||||
(.*)
|
||||
$/sux',
|
||||
$this->description,
|
||||
$matches
|
||||
)) {
|
||||
list(
|
||||
,
|
||||
$static,
|
||||
$this->type,
|
||||
$this->method_name,
|
||||
$this->arguments,
|
||||
$this->description
|
||||
) = $matches;
|
||||
if ($static) {
|
||||
if (!$this->type) {
|
||||
$this->type = 'static';
|
||||
} else {
|
||||
$this->isStatic = true;
|
||||
}
|
||||
} else {
|
||||
if (!$this->type) {
|
||||
$this->type = 'void';
|
||||
}
|
||||
}
|
||||
$this->parsedDescription = null;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the name of this method.
|
||||
*
|
||||
* @param string $method_name The name of the method.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setMethodName($method_name)
|
||||
{
|
||||
$this->method_name = $method_name;
|
||||
|
||||
$this->content = null;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the method name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getMethodName()
|
||||
{
|
||||
return $this->method_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the arguments for this method.
|
||||
*
|
||||
* @param string $arguments A comma-separated arguments line.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setArguments($arguments)
|
||||
{
|
||||
$this->arguments = $arguments;
|
||||
|
||||
$this->content = null;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array containing each argument as array of type and name.
|
||||
*
|
||||
* Please note that the argument sub-array may only contain 1 element if no
|
||||
* type was specified.
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getArguments()
|
||||
{
|
||||
if (empty($this->arguments)) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$arguments = explode(',', $this->arguments);
|
||||
foreach ($arguments as $key => $value) {
|
||||
$arguments[$key] = explode(' ', trim($value));
|
||||
}
|
||||
|
||||
return $arguments;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the method tag describes a static method or not.
|
||||
*
|
||||
* @return bool TRUE if the method declaration is for a static method, FALSE
|
||||
* otherwise.
|
||||
*/
|
||||
public function isStatic()
|
||||
{
|
||||
return $this->isStatic;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a new value for whether the method is static or not.
|
||||
*
|
||||
* @param bool $isStatic The new value to set.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setIsStatic($isStatic)
|
||||
{
|
||||
$this->isStatic = $isStatic;
|
||||
|
||||
$this->content = null;
|
||||
return $this;
|
||||
}
|
||||
}
|
@@ -1,119 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
/**
|
||||
* Reflection class for a @param tag in a Docblock.
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class ParamTag extends ReturnTag
|
||||
{
|
||||
/** @var string */
|
||||
protected $variableName = '';
|
||||
|
||||
/** @var bool determines whether this is a variadic argument */
|
||||
protected $isVariadic = false;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getContent()
|
||||
{
|
||||
if (null === $this->content) {
|
||||
$this->content
|
||||
= "{$this->type} {$this->variableName} {$this->description}";
|
||||
}
|
||||
return $this->content;
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setContent($content)
|
||||
{
|
||||
Tag::setContent($content);
|
||||
$parts = preg_split(
|
||||
'/(\s+)/Su',
|
||||
$this->description,
|
||||
3,
|
||||
PREG_SPLIT_DELIM_CAPTURE
|
||||
);
|
||||
|
||||
// if the first item that is encountered is not a variable; it is a type
|
||||
if (isset($parts[0])
|
||||
&& (strlen($parts[0]) > 0)
|
||||
&& ($parts[0][0] !== '$')
|
||||
) {
|
||||
$this->type = array_shift($parts);
|
||||
array_shift($parts);
|
||||
}
|
||||
|
||||
// if the next item starts with a $ or ...$ it must be the variable name
|
||||
if (isset($parts[0])
|
||||
&& (strlen($parts[0]) > 0)
|
||||
&& ($parts[0][0] == '$' || substr($parts[0], 0, 4) === '...$')
|
||||
) {
|
||||
$this->variableName = array_shift($parts);
|
||||
array_shift($parts);
|
||||
|
||||
if (substr($this->variableName, 0, 3) === '...') {
|
||||
$this->isVariadic = true;
|
||||
$this->variableName = substr($this->variableName, 3);
|
||||
}
|
||||
}
|
||||
|
||||
$this->setDescription(implode('', $parts));
|
||||
|
||||
$this->content = $content;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the variable's name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getVariableName()
|
||||
{
|
||||
return $this->variableName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the variable's name.
|
||||
*
|
||||
* @param string $name The new name for this variable.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setVariableName($name)
|
||||
{
|
||||
$this->variableName = $name;
|
||||
|
||||
$this->content = null;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this tag is variadic.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isVariadic()
|
||||
{
|
||||
return $this->isVariadic;
|
||||
}
|
||||
}
|
@@ -1,24 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
/**
|
||||
* Reflection class for a @property-read tag in a Docblock.
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class PropertyReadTag extends PropertyTag
|
||||
{
|
||||
}
|
@@ -1,24 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
/**
|
||||
* Reflection class for a @property tag in a Docblock.
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class PropertyTag extends ParamTag
|
||||
{
|
||||
}
|
@@ -1,24 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
/**
|
||||
* Reflection class for a @property-write tag in a Docblock.
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class PropertyWriteTag extends PropertyTag
|
||||
{
|
||||
}
|
@@ -1,99 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Tag;
|
||||
use phpDocumentor\Reflection\DocBlock\Type\Collection;
|
||||
|
||||
/**
|
||||
* Reflection class for a @return tag in a Docblock.
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class ReturnTag extends Tag
|
||||
{
|
||||
/** @var string The raw type component. */
|
||||
protected $type = '';
|
||||
|
||||
/** @var Collection The parsed type component. */
|
||||
protected $types = null;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getContent()
|
||||
{
|
||||
if (null === $this->content) {
|
||||
$this->content = "{$this->type} {$this->description}";
|
||||
}
|
||||
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setContent($content)
|
||||
{
|
||||
parent::setContent($content);
|
||||
|
||||
$parts = preg_split('/\s+/Su', $this->description, 2);
|
||||
|
||||
// any output is considered a type
|
||||
$this->type = $parts[0];
|
||||
$this->types = null;
|
||||
|
||||
$this->setDescription(isset($parts[1]) ? $parts[1] : '');
|
||||
|
||||
$this->content = $content;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the unique types of the variable.
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getTypes()
|
||||
{
|
||||
return $this->getTypesCollection()->getArrayCopy();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type section of the variable.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return (string) $this->getTypesCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type collection.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function getTypesCollection()
|
||||
{
|
||||
if (null === $this->types) {
|
||||
$this->types = new Collection(
|
||||
array($this->type),
|
||||
$this->docblock ? $this->docblock->getContext() : null
|
||||
);
|
||||
}
|
||||
return $this->types;
|
||||
}
|
||||
}
|
@@ -1,81 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
/**
|
||||
* Reflection class for a @see tag in a Docblock.
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class SeeTag extends Tag
|
||||
{
|
||||
/** @var string */
|
||||
protected $refers = null;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getContent()
|
||||
{
|
||||
if (null === $this->content) {
|
||||
$this->content = "{$this->refers} {$this->description}";
|
||||
}
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setContent($content)
|
||||
{
|
||||
parent::setContent($content);
|
||||
$parts = preg_split('/\s+/Su', $this->description, 2);
|
||||
|
||||
// any output is considered a type
|
||||
$this->refers = $parts[0];
|
||||
|
||||
$this->setDescription(isset($parts[1]) ? $parts[1] : '');
|
||||
|
||||
$this->content = $content;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the structural element this tag refers to.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getReference()
|
||||
{
|
||||
return $this->refers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the structural element this tag refers to.
|
||||
*
|
||||
* @param string $refers The new type this tag refers to.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setReference($refers)
|
||||
{
|
||||
$this->refers = $refers;
|
||||
|
||||
$this->content = null;
|
||||
return $this;
|
||||
}
|
||||
}
|
@@ -1,26 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Vasil Rangelov <boen.robot@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Tag\VersionTag;
|
||||
|
||||
/**
|
||||
* Reflection class for a @since tag in a Docblock.
|
||||
*
|
||||
* @author Vasil Rangelov <boen.robot@gmail.com>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class SinceTag extends VersionTag
|
||||
{
|
||||
}
|
@@ -1,137 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Vasil Rangelov <boen.robot@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
/**
|
||||
* Reflection class for a @source tag in a Docblock.
|
||||
*
|
||||
* @author Vasil Rangelov <boen.robot@gmail.com>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class SourceTag extends Tag
|
||||
{
|
||||
/**
|
||||
* @var int The starting line, relative to the structural element's
|
||||
* location.
|
||||
*/
|
||||
protected $startingLine = 1;
|
||||
|
||||
/**
|
||||
* @var int|null The number of lines, relative to the starting line. NULL
|
||||
* means "to the end".
|
||||
*/
|
||||
protected $lineCount = null;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getContent()
|
||||
{
|
||||
if (null === $this->content) {
|
||||
$this->content
|
||||
= "{$this->startingLine} {$this->lineCount} {$this->description}";
|
||||
}
|
||||
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setContent($content)
|
||||
{
|
||||
parent::setContent($content);
|
||||
if (preg_match(
|
||||
'/^
|
||||
# Starting line
|
||||
([1-9]\d*)
|
||||
\s*
|
||||
# Number of lines
|
||||
(?:
|
||||
((?1))
|
||||
\s+
|
||||
)?
|
||||
# Description
|
||||
(.*)
|
||||
$/sux',
|
||||
$this->description,
|
||||
$matches
|
||||
)) {
|
||||
$this->startingLine = (int)$matches[1];
|
||||
if (isset($matches[2]) && '' !== $matches[2]) {
|
||||
$this->lineCount = (int)$matches[2];
|
||||
}
|
||||
$this->setDescription($matches[3]);
|
||||
$this->content = $content;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the starting line.
|
||||
*
|
||||
* @return int The starting line, relative to the structural element's
|
||||
* location.
|
||||
*/
|
||||
public function getStartingLine()
|
||||
{
|
||||
return $this->startingLine;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the starting line.
|
||||
*
|
||||
* @param int $startingLine The new starting line, relative to the
|
||||
* structural element's location.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setStartingLine($startingLine)
|
||||
{
|
||||
$this->startingLine = $startingLine;
|
||||
|
||||
$this->content = null;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of lines.
|
||||
*
|
||||
* @return int|null The number of lines, relative to the starting line. NULL
|
||||
* means "to the end".
|
||||
*/
|
||||
public function getLineCount()
|
||||
{
|
||||
return $this->lineCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the number of lines.
|
||||
*
|
||||
* @param int|null $lineCount The new number of lines, relative to the
|
||||
* starting line. NULL means "to the end".
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setLineCount($lineCount)
|
||||
{
|
||||
$this->lineCount = $lineCount;
|
||||
|
||||
$this->content = null;
|
||||
return $this;
|
||||
}
|
||||
}
|
@@ -1,24 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
/**
|
||||
* Reflection class for a @throws tag in a Docblock.
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class ThrowsTag extends ReturnTag
|
||||
{
|
||||
}
|
@@ -1,24 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
/**
|
||||
* Reflection class for a @uses tag in a Docblock.
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class UsesTag extends SeeTag
|
||||
{
|
||||
}
|
@@ -1,24 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
/**
|
||||
* Reflection class for a @var tag in a Docblock.
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class VarTag extends ParamTag
|
||||
{
|
||||
}
|
@@ -1,108 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Vasil Rangelov <boen.robot@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
/**
|
||||
* Reflection class for a @version tag in a Docblock.
|
||||
*
|
||||
* @author Vasil Rangelov <boen.robot@gmail.com>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class VersionTag extends Tag
|
||||
{
|
||||
/**
|
||||
* PCRE regular expression matching a version vector.
|
||||
* Assumes the "x" modifier.
|
||||
*/
|
||||
const REGEX_VECTOR = '(?:
|
||||
# Normal release vectors.
|
||||
\d\S*
|
||||
|
|
||||
# VCS version vectors. Per PHPCS, they are expected to
|
||||
# follow the form of the VCS name, followed by ":", followed
|
||||
# by the version vector itself.
|
||||
# By convention, popular VCSes like CVS, SVN and GIT use "$"
|
||||
# around the actual version vector.
|
||||
[^\s\:]+\:\s*\$[^\$]+\$
|
||||
)';
|
||||
|
||||
/** @var string The version vector. */
|
||||
protected $version = '';
|
||||
|
||||
public function getContent()
|
||||
{
|
||||
if (null === $this->content) {
|
||||
$this->content = "{$this->version} {$this->description}";
|
||||
}
|
||||
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setContent($content)
|
||||
{
|
||||
parent::setContent($content);
|
||||
|
||||
if (preg_match(
|
||||
'/^
|
||||
# The version vector
|
||||
(' . self::REGEX_VECTOR . ')
|
||||
\s*
|
||||
# The description
|
||||
(.+)?
|
||||
$/sux',
|
||||
$this->description,
|
||||
$matches
|
||||
)) {
|
||||
$this->version = $matches[1];
|
||||
$this->setDescription(isset($matches[2]) ? $matches[2] : '');
|
||||
$this->content = $content;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the version section of the tag.
|
||||
*
|
||||
* @return string The version section of the tag.
|
||||
*/
|
||||
public function getVersion()
|
||||
{
|
||||
return $this->version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the version section of the tag.
|
||||
*
|
||||
* @param string $version The new version section of the tag.
|
||||
* An invalid value will set an empty string.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setVersion($version)
|
||||
{
|
||||
$this->version
|
||||
= preg_match('/^' . self::REGEX_VECTOR . '$/ux', $version)
|
||||
? $version
|
||||
: '';
|
||||
|
||||
$this->content = null;
|
||||
return $this;
|
||||
}
|
||||
}
|
@@ -1,221 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Type;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Context;
|
||||
|
||||
/**
|
||||
* Collection
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class Collection extends \ArrayObject
|
||||
{
|
||||
/** @var string Definition of the OR operator for types */
|
||||
const OPERATOR_OR = '|';
|
||||
|
||||
/** @var string Definition of the ARRAY operator for types */
|
||||
const OPERATOR_ARRAY = '[]';
|
||||
|
||||
/** @var string Definition of the NAMESPACE operator in PHP */
|
||||
const OPERATOR_NAMESPACE = '\\';
|
||||
|
||||
/** @var string[] List of recognized keywords */
|
||||
protected static $keywords = array(
|
||||
'string', 'int', 'integer', 'bool', 'boolean', 'float', 'double',
|
||||
'object', 'mixed', 'array', 'resource', 'void', 'null', 'scalar',
|
||||
'callback', 'callable', 'false', 'true', 'self', '$this', 'static'
|
||||
);
|
||||
|
||||
/**
|
||||
* Current invoking location.
|
||||
*
|
||||
* This is used to prepend to type with a relative location.
|
||||
* May also be 'default' or 'global', in which case they are ignored.
|
||||
*
|
||||
* @var Context
|
||||
*/
|
||||
protected $context = null;
|
||||
|
||||
/**
|
||||
* Registers the namespace and aliases; uses that to add and expand the
|
||||
* given types.
|
||||
*
|
||||
* @param string[] $types Array containing a list of types to add to this
|
||||
* container.
|
||||
* @param Context $location The current invoking location.
|
||||
*/
|
||||
public function __construct(
|
||||
array $types = array(),
|
||||
Context $context = null
|
||||
) {
|
||||
$this->context = null === $context ? new Context() : $context;
|
||||
|
||||
foreach ($types as $type) {
|
||||
$this->add($type);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current invoking location.
|
||||
*
|
||||
* @return Context
|
||||
*/
|
||||
public function getContext()
|
||||
{
|
||||
return $this->context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new type to the collection and expands it if it contains a
|
||||
* relative namespace.
|
||||
*
|
||||
* If a class in the type contains a relative namespace than this collection
|
||||
* will try to expand that into a FQCN.
|
||||
*
|
||||
* @param string $type A 'Type' as defined in the phpDocumentor
|
||||
* documentation.
|
||||
*
|
||||
* @throws \InvalidArgumentException if a non-string argument is passed.
|
||||
*
|
||||
* @see http://phpdoc.org/docs/latest/for-users/types.html for the
|
||||
* definition of a type.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function add($type)
|
||||
{
|
||||
if (!is_string($type)) {
|
||||
throw new \InvalidArgumentException(
|
||||
'A type should be represented by a string, received: '
|
||||
.var_export($type, true)
|
||||
);
|
||||
}
|
||||
|
||||
// separate the type by the OR operator
|
||||
$type_parts = explode(self::OPERATOR_OR, $type);
|
||||
foreach ($type_parts as $part) {
|
||||
$expanded_type = $this->expand($part);
|
||||
if ($expanded_type) {
|
||||
$this[] = $expanded_type;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of the collection.
|
||||
*
|
||||
* @return string The resolved types across the collection, separated with
|
||||
* {@link self::OPERATOR_OR}.
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return implode(self::OPERATOR_OR, $this->getArrayCopy());
|
||||
}
|
||||
|
||||
/**
|
||||
* Analyzes the given type and returns the FQCN variant.
|
||||
*
|
||||
* When a type is provided this method checks whether it is not a keyword or
|
||||
* Fully Qualified Class Name. If so it will use the given namespace and
|
||||
* aliases to expand the type to a FQCN representation.
|
||||
*
|
||||
* This method only works as expected if the namespace and aliases are set;
|
||||
* no dynamic reflection is being performed here.
|
||||
*
|
||||
* @param string $type The relative or absolute type.
|
||||
*
|
||||
* @uses getNamespace to determine with what to prefix the type name.
|
||||
* @uses getNamespaceAliases to check whether the first part of the relative
|
||||
* type name should not be replaced with another namespace.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function expand($type)
|
||||
{
|
||||
$type = trim($type);
|
||||
if (!$type) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if ($this->isTypeAnArray($type)) {
|
||||
return $this->expand(substr($type, 0, -2)) . self::OPERATOR_ARRAY;
|
||||
}
|
||||
|
||||
if ($this->isRelativeType($type) && !$this->isTypeAKeyword($type)) {
|
||||
$type_parts = explode(self::OPERATOR_NAMESPACE, $type, 2);
|
||||
|
||||
$namespace_aliases = $this->context->getNamespaceAliases();
|
||||
// if the first segment is not an alias; prepend namespace name and
|
||||
// return
|
||||
if (!isset($namespace_aliases[$type_parts[0]])) {
|
||||
$namespace = $this->context->getNamespace();
|
||||
if ('' !== $namespace) {
|
||||
$namespace .= self::OPERATOR_NAMESPACE;
|
||||
}
|
||||
return self::OPERATOR_NAMESPACE . $namespace . $type;
|
||||
}
|
||||
|
||||
$type_parts[0] = $namespace_aliases[$type_parts[0]];
|
||||
$type = implode(self::OPERATOR_NAMESPACE, $type_parts);
|
||||
}
|
||||
|
||||
return $type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detects whether the given type represents an array.
|
||||
*
|
||||
* @param string $type A relative or absolute type as defined in the
|
||||
* phpDocumentor documentation.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function isTypeAnArray($type)
|
||||
{
|
||||
return substr($type, -2) === self::OPERATOR_ARRAY;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detects whether the given type represents a PHPDoc keyword.
|
||||
*
|
||||
* @param string $type A relative or absolute type as defined in the
|
||||
* phpDocumentor documentation.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function isTypeAKeyword($type)
|
||||
{
|
||||
return in_array(strtolower($type), static::$keywords, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Detects whether the given type represents a relative or absolute path.
|
||||
*
|
||||
* This method will detect keywords as being absolute; even though they are
|
||||
* not preceeded by a namespace separator.
|
||||
*
|
||||
* @param string $type A relative or absolute type as defined in the
|
||||
* phpDocumentor documentation.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function isRelativeType($type)
|
||||
{
|
||||
return ($type[0] !== self::OPERATOR_NAMESPACE)
|
||||
|| $this->isTypeAKeyword($type);
|
||||
}
|
||||
}
|
97
vendor/phpdocumentor/reflection-docblock/tests/integration/InterpretingDocBlocksTest.php
vendored
Normal file
97
vendor/phpdocumentor/reflection-docblock/tests/integration/InterpretingDocBlocksTest.php
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of phpDocumentor.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Description;
|
||||
use phpDocumentor\Reflection\DocBlock\StandardTagFactory;
|
||||
use phpDocumentor\Reflection\DocBlock\Tag;
|
||||
use phpDocumentor\Reflection\DocBlock\Tags\See;
|
||||
|
||||
/**
|
||||
* @coversNothing
|
||||
*/
|
||||
class InterpretingDocBlocksTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testInterpretingASimpleDocBlock()
|
||||
{
|
||||
/**
|
||||
* @var DocBlock $docblock
|
||||
* @var string $summary
|
||||
* @var Description $description
|
||||
*/
|
||||
include(__DIR__ . '/../../examples/01-interpreting-a-simple-docblock.php');
|
||||
|
||||
$descriptionText = <<<DESCRIPTION
|
||||
This is a Description. A Summary and Description are separated by either
|
||||
two subsequent newlines (thus a whiteline in between as can be seen in this
|
||||
example), or when the Summary ends with a dot (`.`) and some form of
|
||||
whitespace.
|
||||
DESCRIPTION;
|
||||
|
||||
$this->assertInstanceOf(DocBlock::class, $docblock);
|
||||
$this->assertSame('This is an example of a summary.', $summary);
|
||||
$this->assertInstanceOf(Description::class, $description);
|
||||
$this->assertSame($descriptionText, $description->render());
|
||||
$this->assertEmpty($docblock->getTags());
|
||||
}
|
||||
|
||||
public function testInterpretingTags()
|
||||
{
|
||||
/**
|
||||
* @var DocBlock $docblock
|
||||
* @var boolean $hasSeeTag
|
||||
* @var Tag[] $tags
|
||||
* @var See[] $seeTags
|
||||
*/
|
||||
include(__DIR__ . '/../../examples/02-interpreting-tags.php');
|
||||
|
||||
$this->assertTrue($hasSeeTag);
|
||||
$this->assertCount(1, $tags);
|
||||
$this->assertCount(1, $seeTags);
|
||||
|
||||
$this->assertInstanceOf(See::class, $tags[0]);
|
||||
$this->assertInstanceOf(See::class, $seeTags[0]);
|
||||
|
||||
$seeTag = $seeTags[0];
|
||||
$this->assertSame('\\' . StandardTagFactory::class, (string)$seeTag->getReference());
|
||||
$this->assertSame('', (string)$seeTag->getDescription());
|
||||
}
|
||||
|
||||
public function testDescriptionsCanEscapeAtSignsAndClosingBraces()
|
||||
{
|
||||
/**
|
||||
* @var string $docComment
|
||||
* @var DocBlock $docblock
|
||||
* @var Description $description
|
||||
* @var string $receivedDocComment
|
||||
* @var string $foundDescription
|
||||
*/
|
||||
|
||||
include(__DIR__ . '/../../examples/playing-with-descriptions/02-escaping.php');
|
||||
$this->assertSame(<<<'DESCRIPTION'
|
||||
You can escape the @-sign by surrounding it with braces, for example: @. And escape a closing brace within an
|
||||
inline tag by adding an opening brace in front of it like this: }.
|
||||
|
||||
Here are example texts where you can see how they could be used in a real life situation:
|
||||
|
||||
This is a text with an {@internal inline tag where a closing brace (}) is shown}.
|
||||
Or an {@internal inline tag with a literal {@link} in it}.
|
||||
|
||||
Do note that an {@internal inline tag that has an opening brace ({) does not break out}.
|
||||
DESCRIPTION
|
||||
,
|
||||
$foundDescription
|
||||
)
|
||||
;
|
||||
}
|
||||
}
|
35
vendor/phpdocumentor/reflection-docblock/tests/integration/ReconstitutingADocBlockTest.php
vendored
Normal file
35
vendor/phpdocumentor/reflection-docblock/tests/integration/ReconstitutingADocBlockTest.php
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of phpDocumentor.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Description;
|
||||
use phpDocumentor\Reflection\DocBlock\StandardTagFactory;
|
||||
use phpDocumentor\Reflection\DocBlock\Tag;
|
||||
use phpDocumentor\Reflection\DocBlock\Tags\See;
|
||||
|
||||
/**
|
||||
* @coversNothing
|
||||
*/
|
||||
class ReconstitutingADocBlockTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testReconstituteADocBlock()
|
||||
{
|
||||
/**
|
||||
* @var string $docComment
|
||||
* @var string $reconstitutedDocComment
|
||||
*/
|
||||
include(__DIR__ . '/../../examples/03-reconstituting-a-docblock.php');
|
||||
|
||||
$this->assertSame($docComment, $reconstitutedDocComment);
|
||||
}
|
||||
}
|
39
vendor/phpdocumentor/reflection-docblock/tests/integration/UsingTagsTest.php
vendored
Normal file
39
vendor/phpdocumentor/reflection-docblock/tests/integration/UsingTagsTest.php
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of phpDocumentor.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Description;
|
||||
use phpDocumentor\Reflection\DocBlock\StandardTagFactory;
|
||||
use phpDocumentor\Reflection\DocBlock\Tag;
|
||||
use phpDocumentor\Reflection\DocBlock\Tags\See;
|
||||
|
||||
/**
|
||||
* @coversNothing
|
||||
*/
|
||||
class UsingTagsTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testAddingYourOwnTagUsingAStaticMethodAsFactory()
|
||||
{
|
||||
/**
|
||||
* @var object[] $customTagObjects
|
||||
* @var string $docComment
|
||||
* @var string $reconstitutedDocComment
|
||||
*/
|
||||
include(__DIR__ . '/../../examples/04-adding-your-own-tag.php');
|
||||
|
||||
$this->assertInstanceOf(\MyTag::class, $customTagObjects[0]);
|
||||
$this->assertSame('my-tag', $customTagObjects[0]->getName());
|
||||
$this->assertSame('I have a description', (string)$customTagObjects[0]->getDescription());
|
||||
$this->assertSame($docComment, $reconstitutedDocComment);
|
||||
}
|
||||
}
|
@@ -1,245 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor Description Test
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Vasil Rangelov <boen.robot@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock;
|
||||
|
||||
/**
|
||||
* Test class for \phpDocumentor\Reflection\DocBlock\Description
|
||||
*
|
||||
* @author Vasil Rangelov <boen.robot@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class DescriptionTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testConstruct()
|
||||
{
|
||||
$fixture = <<<LONGDESC
|
||||
This is text for a description.
|
||||
LONGDESC;
|
||||
$object = new Description($fixture);
|
||||
$this->assertSame($fixture, $object->getContents());
|
||||
|
||||
$parsedContents = $object->getParsedContents();
|
||||
$this->assertCount(1, $parsedContents);
|
||||
$this->assertSame($fixture, $parsedContents[0]);
|
||||
}
|
||||
|
||||
public function testInlineTagParsing()
|
||||
{
|
||||
$fixture = <<<LONGDESC
|
||||
This is text for a {@link http://phpdoc.org/ description} that uses inline
|
||||
tags.
|
||||
LONGDESC;
|
||||
$object = new Description($fixture);
|
||||
$this->assertSame($fixture, $object->getContents());
|
||||
|
||||
$parsedContents = $object->getParsedContents();
|
||||
$this->assertCount(3, $parsedContents);
|
||||
$this->assertSame('This is text for a ', $parsedContents[0]);
|
||||
$this->assertInstanceOf(
|
||||
__NAMESPACE__ . '\Tag\LinkTag',
|
||||
$parsedContents[1]
|
||||
);
|
||||
$this->assertSame(
|
||||
' that uses inline
|
||||
tags.',
|
||||
$parsedContents[2]
|
||||
);
|
||||
}
|
||||
|
||||
public function testInlineTagAtStartParsing()
|
||||
{
|
||||
$fixture = <<<LONGDESC
|
||||
{@link http://phpdoc.org/ This} is text for a description that uses inline
|
||||
tags.
|
||||
LONGDESC;
|
||||
$object = new Description($fixture);
|
||||
$this->assertSame($fixture, $object->getContents());
|
||||
|
||||
$parsedContents = $object->getParsedContents();
|
||||
$this->assertCount(3, $parsedContents);
|
||||
|
||||
$this->assertSame('', $parsedContents[0]);
|
||||
$this->assertInstanceOf(
|
||||
__NAMESPACE__ . '\Tag\LinkTag',
|
||||
$parsedContents[1]
|
||||
);
|
||||
$this->assertSame(
|
||||
' is text for a description that uses inline
|
||||
tags.',
|
||||
$parsedContents[2]
|
||||
);
|
||||
}
|
||||
|
||||
public function testNestedInlineTagParsing()
|
||||
{
|
||||
$fixture = <<<LONGDESC
|
||||
This is text for a description with {@internal inline tag with
|
||||
{@link http://phpdoc.org another inline tag} in it}.
|
||||
LONGDESC;
|
||||
$object = new Description($fixture);
|
||||
$this->assertSame($fixture, $object->getContents());
|
||||
|
||||
$parsedContents = $object->getParsedContents();
|
||||
$this->assertCount(3, $parsedContents);
|
||||
|
||||
$this->assertSame(
|
||||
'This is text for a description with ',
|
||||
$parsedContents[0]
|
||||
);
|
||||
$this->assertInstanceOf(
|
||||
__NAMESPACE__ . '\Tag',
|
||||
$parsedContents[1]
|
||||
);
|
||||
$this->assertSame('.', $parsedContents[2]);
|
||||
|
||||
$parsedDescription = $parsedContents[1]->getParsedDescription();
|
||||
$this->assertCount(3, $parsedDescription);
|
||||
$this->assertSame("inline tag with\n", $parsedDescription[0]);
|
||||
$this->assertInstanceOf(
|
||||
__NAMESPACE__ . '\Tag\LinkTag',
|
||||
$parsedDescription[1]
|
||||
);
|
||||
$this->assertSame(' in it', $parsedDescription[2]);
|
||||
}
|
||||
|
||||
public function testLiteralOpeningDelimiter()
|
||||
{
|
||||
$fixture = <<<LONGDESC
|
||||
This is text for a description containing { that is literal.
|
||||
LONGDESC;
|
||||
$object = new Description($fixture);
|
||||
$this->assertSame($fixture, $object->getContents());
|
||||
|
||||
$parsedContents = $object->getParsedContents();
|
||||
$this->assertCount(1, $parsedContents);
|
||||
$this->assertSame($fixture, $parsedContents[0]);
|
||||
}
|
||||
|
||||
public function testNestedLiteralOpeningDelimiter()
|
||||
{
|
||||
$fixture = <<<LONGDESC
|
||||
This is text for a description containing {@internal inline tag that has { that
|
||||
is literal}.
|
||||
LONGDESC;
|
||||
$object = new Description($fixture);
|
||||
$this->assertSame($fixture, $object->getContents());
|
||||
|
||||
$parsedContents = $object->getParsedContents();
|
||||
$this->assertCount(3, $parsedContents);
|
||||
$this->assertSame(
|
||||
'This is text for a description containing ',
|
||||
$parsedContents[0]
|
||||
);
|
||||
$this->assertInstanceOf(
|
||||
__NAMESPACE__ . '\Tag',
|
||||
$parsedContents[1]
|
||||
);
|
||||
$this->assertSame('.', $parsedContents[2]);
|
||||
|
||||
$this->assertSame(
|
||||
array('inline tag that has { that
|
||||
is literal'),
|
||||
$parsedContents[1]->getParsedDescription()
|
||||
);
|
||||
}
|
||||
|
||||
public function testLiteralClosingDelimiter()
|
||||
{
|
||||
$fixture = <<<LONGDESC
|
||||
This is text for a description with {} that is not a tag.
|
||||
LONGDESC;
|
||||
$object = new Description($fixture);
|
||||
$this->assertSame($fixture, $object->getContents());
|
||||
|
||||
$parsedContents = $object->getParsedContents();
|
||||
$this->assertCount(1, $parsedContents);
|
||||
$this->assertSame(
|
||||
'This is text for a description with } that is not a tag.',
|
||||
$parsedContents[0]
|
||||
);
|
||||
}
|
||||
|
||||
public function testNestedLiteralClosingDelimiter()
|
||||
{
|
||||
$fixture = <<<LONGDESC
|
||||
This is text for a description with {@internal inline tag with {} that is not an
|
||||
inline tag}.
|
||||
LONGDESC;
|
||||
$object = new Description($fixture);
|
||||
$this->assertSame($fixture, $object->getContents());
|
||||
|
||||
$parsedContents = $object->getParsedContents();
|
||||
$this->assertCount(3, $parsedContents);
|
||||
$this->assertSame(
|
||||
'This is text for a description with ',
|
||||
$parsedContents[0]
|
||||
);
|
||||
$this->assertInstanceOf(
|
||||
__NAMESPACE__ . '\Tag',
|
||||
$parsedContents[1]
|
||||
);
|
||||
$this->assertSame('.', $parsedContents[2]);
|
||||
|
||||
$this->assertSame(
|
||||
array('inline tag with } that is not an
|
||||
inline tag'),
|
||||
$parsedContents[1]->getParsedDescription()
|
||||
);
|
||||
}
|
||||
|
||||
public function testInlineTagEscapingSequence()
|
||||
{
|
||||
$fixture = <<<LONGDESC
|
||||
This is text for a description with literal {{@}link}.
|
||||
LONGDESC;
|
||||
$object = new Description($fixture);
|
||||
$this->assertSame($fixture, $object->getContents());
|
||||
|
||||
$parsedContents = $object->getParsedContents();
|
||||
$this->assertCount(1, $parsedContents);
|
||||
$this->assertSame(
|
||||
'This is text for a description with literal {@link}.',
|
||||
$parsedContents[0]
|
||||
);
|
||||
}
|
||||
|
||||
public function testNestedInlineTagEscapingSequence()
|
||||
{
|
||||
$fixture = <<<LONGDESC
|
||||
This is text for a description with an {@internal inline tag with literal
|
||||
{{@}link{} in it}.
|
||||
LONGDESC;
|
||||
$object = new Description($fixture);
|
||||
$this->assertSame($fixture, $object->getContents());
|
||||
|
||||
$parsedContents = $object->getParsedContents();
|
||||
$this->assertCount(3, $parsedContents);
|
||||
$this->assertSame(
|
||||
'This is text for a description with an ',
|
||||
$parsedContents[0]
|
||||
);
|
||||
$this->assertInstanceOf(
|
||||
__NAMESPACE__ . '\Tag',
|
||||
$parsedContents[1]
|
||||
);
|
||||
$this->assertSame('.', $parsedContents[2]);
|
||||
|
||||
$this->assertSame(
|
||||
array('inline tag with literal
|
||||
{@link} in it'),
|
||||
$parsedContents[1]->getParsedDescription()
|
||||
);
|
||||
}
|
||||
}
|
@@ -1,86 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor Covers Tag Test
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @author Daniel O'Connor <daniel.oconnor@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
/**
|
||||
* Test class for \phpDocumentor\Reflection\DocBlock\Tag\CoversTag
|
||||
*
|
||||
* @author Daniel O'Connor <daniel.oconnor@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class CoversTagTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\CoversTag can create
|
||||
* a link for the covers doc block.
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $content
|
||||
* @param string $exContent
|
||||
* @param string $exReference
|
||||
*
|
||||
* @covers \phpDocumentor\Reflection\DocBlock\Tag\CoversTag
|
||||
* @dataProvider provideDataForConstuctor
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConstructorParesInputsIntoCorrectFields(
|
||||
$type,
|
||||
$content,
|
||||
$exContent,
|
||||
$exDescription,
|
||||
$exReference
|
||||
) {
|
||||
$tag = new CoversTag($type, $content);
|
||||
|
||||
$this->assertEquals($type, $tag->getName());
|
||||
$this->assertEquals($exContent, $tag->getContent());
|
||||
$this->assertEquals($exDescription, $tag->getDescription());
|
||||
$this->assertEquals($exReference, $tag->getReference());
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testConstructorParesInputsIntoCorrectFields
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provideDataForConstuctor()
|
||||
{
|
||||
// $type, $content, $exContent, $exDescription, $exReference
|
||||
return array(
|
||||
array(
|
||||
'covers',
|
||||
'Foo::bar()',
|
||||
'Foo::bar()',
|
||||
'',
|
||||
'Foo::bar()'
|
||||
),
|
||||
array(
|
||||
'covers',
|
||||
'Foo::bar() Testing',
|
||||
'Foo::bar() Testing',
|
||||
'Testing',
|
||||
'Foo::bar()',
|
||||
),
|
||||
array(
|
||||
'covers',
|
||||
'Foo::bar() Testing comments',
|
||||
'Foo::bar() Testing comments',
|
||||
'Testing comments',
|
||||
'Foo::bar()',
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@@ -1,115 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor Deprecated Tag Test
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @author Vasil Rangelov <boen.robot@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
/**
|
||||
* Test class for \phpDocumentor\Reflection\DocBlock\Tag\DeprecatedTag
|
||||
*
|
||||
* @author Vasil Rangelov <boen.robot@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class DeprecatedTagTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\LinkTag can create
|
||||
* a link for the @deprecated doc block.
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $content
|
||||
* @param string $exContent
|
||||
* @param string $exDescription
|
||||
* @param string $exVersion
|
||||
*
|
||||
* @covers \phpDocumentor\Reflection\DocBlock\Tag\DeprecatedTag
|
||||
* @dataProvider provideDataForConstuctor
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConstructorParesInputsIntoCorrectFields(
|
||||
$type,
|
||||
$content,
|
||||
$exContent,
|
||||
$exDescription,
|
||||
$exVersion
|
||||
) {
|
||||
$tag = new DeprecatedTag($type, $content);
|
||||
|
||||
$this->assertEquals($type, $tag->getName());
|
||||
$this->assertEquals($exContent, $tag->getContent());
|
||||
$this->assertEquals($exDescription, $tag->getDescription());
|
||||
$this->assertEquals($exVersion, $tag->getVersion());
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testConstructorParesInputsIntoCorrectFields
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provideDataForConstuctor()
|
||||
{
|
||||
// $type, $content, $exContent, $exDescription, $exVersion
|
||||
return array(
|
||||
array(
|
||||
'deprecated',
|
||||
'1.0 First release.',
|
||||
'1.0 First release.',
|
||||
'First release.',
|
||||
'1.0'
|
||||
),
|
||||
array(
|
||||
'deprecated',
|
||||
"1.0\nFirst release.",
|
||||
"1.0\nFirst release.",
|
||||
'First release.',
|
||||
'1.0'
|
||||
),
|
||||
array(
|
||||
'deprecated',
|
||||
"1.0\nFirst\nrelease.",
|
||||
"1.0\nFirst\nrelease.",
|
||||
"First\nrelease.",
|
||||
'1.0'
|
||||
),
|
||||
array(
|
||||
'deprecated',
|
||||
'Unfinished release',
|
||||
'Unfinished release',
|
||||
'Unfinished release',
|
||||
''
|
||||
),
|
||||
array(
|
||||
'deprecated',
|
||||
'1.0',
|
||||
'1.0',
|
||||
'',
|
||||
'1.0'
|
||||
),
|
||||
array(
|
||||
'deprecated',
|
||||
'GIT: $Id$',
|
||||
'GIT: $Id$',
|
||||
'',
|
||||
'GIT: $Id$'
|
||||
),
|
||||
array(
|
||||
'deprecated',
|
||||
'GIT: $Id$ Dev build',
|
||||
'GIT: $Id$ Dev build',
|
||||
'Dev build',
|
||||
'GIT: $Id$'
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
@@ -1,203 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor Example Tag Test
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @author Vasil Rangelov <boen.robot@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
/**
|
||||
* Test class for \phpDocumentor\Reflection\DocBlock\Tag\ExampleTag
|
||||
*
|
||||
* @author Vasil Rangelov <boen.robot@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class ExampleTagTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\SourceTag can
|
||||
* understand the @source DocBlock.
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $content
|
||||
* @param string $exContent
|
||||
* @param string $exStartingLine
|
||||
* @param string $exLineCount
|
||||
* @param string $exFilepath
|
||||
*
|
||||
* @covers \phpDocumentor\Reflection\DocBlock\Tag\ExampleTag
|
||||
* @dataProvider provideDataForConstuctor
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConstructorParesInputsIntoCorrectFields(
|
||||
$type,
|
||||
$content,
|
||||
$exContent,
|
||||
$exDescription,
|
||||
$exStartingLine,
|
||||
$exLineCount,
|
||||
$exFilePath
|
||||
) {
|
||||
$tag = new ExampleTag($type, $content);
|
||||
|
||||
$this->assertEquals($type, $tag->getName());
|
||||
$this->assertEquals($exContent, $tag->getContent());
|
||||
$this->assertEquals($exDescription, $tag->getDescription());
|
||||
$this->assertEquals($exStartingLine, $tag->getStartingLine());
|
||||
$this->assertEquals($exLineCount, $tag->getLineCount());
|
||||
$this->assertEquals($exFilePath, $tag->getFilePath());
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testConstructorParesInputsIntoCorrectFields
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provideDataForConstuctor()
|
||||
{
|
||||
// $type,
|
||||
// $content,
|
||||
// $exContent,
|
||||
// $exDescription,
|
||||
// $exStartingLine,
|
||||
// $exLineCount,
|
||||
// $exFilePath
|
||||
return array(
|
||||
array(
|
||||
'example',
|
||||
'file.php',
|
||||
'file.php',
|
||||
'',
|
||||
1,
|
||||
null,
|
||||
'file.php'
|
||||
),
|
||||
array(
|
||||
'example',
|
||||
'Testing comments',
|
||||
'Testing comments',
|
||||
'comments',
|
||||
1,
|
||||
null,
|
||||
'Testing'
|
||||
),
|
||||
array(
|
||||
'example',
|
||||
'file.php 2 Testing',
|
||||
'file.php 2 Testing',
|
||||
'Testing',
|
||||
2,
|
||||
null,
|
||||
'file.php'
|
||||
),
|
||||
array(
|
||||
'example',
|
||||
'file.php 2 3 Testing comments',
|
||||
'file.php 2 3 Testing comments',
|
||||
'Testing comments',
|
||||
2,
|
||||
3,
|
||||
'file.php'
|
||||
),
|
||||
array(
|
||||
'example',
|
||||
'file.php 2 -1 Testing comments',
|
||||
'file.php 2 -1 Testing comments',
|
||||
'-1 Testing comments',
|
||||
2,
|
||||
null,
|
||||
'file.php'
|
||||
),
|
||||
array(
|
||||
'example',
|
||||
'file.php -1 1 Testing comments',
|
||||
'file.php -1 1 Testing comments',
|
||||
'-1 1 Testing comments',
|
||||
1,
|
||||
null,
|
||||
'file.php'
|
||||
),
|
||||
array(
|
||||
'example',
|
||||
'"file with spaces.php" Testing comments',
|
||||
'"file with spaces.php" Testing comments',
|
||||
'Testing comments',
|
||||
1,
|
||||
null,
|
||||
'file with spaces.php'
|
||||
),
|
||||
array(
|
||||
'example',
|
||||
'"file with spaces.php" 2 Testing comments',
|
||||
'"file with spaces.php" 2 Testing comments',
|
||||
'Testing comments',
|
||||
2,
|
||||
null,
|
||||
'file with spaces.php'
|
||||
),
|
||||
array(
|
||||
'example',
|
||||
'"file with spaces.php" 2 3 Testing comments',
|
||||
'"file with spaces.php" 2 3 Testing comments',
|
||||
'Testing comments',
|
||||
2,
|
||||
3,
|
||||
'file with spaces.php'
|
||||
),
|
||||
array(
|
||||
'example',
|
||||
'"file with spaces.php" 2 -3 Testing comments',
|
||||
'"file with spaces.php" 2 -3 Testing comments',
|
||||
'-3 Testing comments',
|
||||
2,
|
||||
null,
|
||||
'file with spaces.php'
|
||||
),
|
||||
array(
|
||||
'example',
|
||||
'"file with spaces.php" -2 3 Testing comments',
|
||||
'"file with spaces.php" -2 3 Testing comments',
|
||||
'-2 3 Testing comments',
|
||||
1,
|
||||
null,
|
||||
'file with spaces.php'
|
||||
),
|
||||
array(
|
||||
'example',
|
||||
'file%20with%20spaces.php Testing comments',
|
||||
'file%20with%20spaces.php Testing comments',
|
||||
'Testing comments',
|
||||
1,
|
||||
null,
|
||||
'file with spaces.php'
|
||||
),
|
||||
array(
|
||||
'example',
|
||||
'folder/file%20with%20spaces.php Testing comments',
|
||||
'folder/file%20with%20spaces.php Testing comments',
|
||||
'Testing comments',
|
||||
1,
|
||||
null,
|
||||
'folder/file with spaces.php'
|
||||
),
|
||||
array(
|
||||
'example',
|
||||
'http://example.com/file%20with%20spaces.php Testing comments',
|
||||
'http://example.com/file%20with%20spaces.php Testing comments',
|
||||
'Testing comments',
|
||||
1,
|
||||
null,
|
||||
'http://example.com/file%20with%20spaces.php'
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
@@ -1,87 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor Link Tag Test
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @author Ben Selby <benmatselby@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
/**
|
||||
* Test class for \phpDocumentor\Reflection\DocBlock\Tag\LinkTag
|
||||
*
|
||||
* @author Ben Selby <benmatselby@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class LinkTagTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\LinkTag can create
|
||||
* a link for the @link doc block.
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $content
|
||||
* @param string $exContent
|
||||
* @param string $exDescription
|
||||
* @param string $exLink
|
||||
*
|
||||
* @covers \phpDocumentor\Reflection\DocBlock\Tag\LinkTag
|
||||
* @dataProvider provideDataForConstuctor
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConstructorParesInputsIntoCorrectFields(
|
||||
$type,
|
||||
$content,
|
||||
$exContent,
|
||||
$exDescription,
|
||||
$exLink
|
||||
) {
|
||||
$tag = new LinkTag($type, $content);
|
||||
|
||||
$this->assertEquals($type, $tag->getName());
|
||||
$this->assertEquals($exContent, $tag->getContent());
|
||||
$this->assertEquals($exDescription, $tag->getDescription());
|
||||
$this->assertEquals($exLink, $tag->getLink());
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testConstructorParesInputsIntoCorrectFields
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provideDataForConstuctor()
|
||||
{
|
||||
// $type, $content, $exContent, $exDescription, $exLink
|
||||
return array(
|
||||
array(
|
||||
'link',
|
||||
'http://www.phpdoc.org/',
|
||||
'http://www.phpdoc.org/',
|
||||
'http://www.phpdoc.org/',
|
||||
'http://www.phpdoc.org/'
|
||||
),
|
||||
array(
|
||||
'link',
|
||||
'http://www.phpdoc.org/ Testing',
|
||||
'http://www.phpdoc.org/ Testing',
|
||||
'Testing',
|
||||
'http://www.phpdoc.org/'
|
||||
),
|
||||
array(
|
||||
'link',
|
||||
'http://www.phpdoc.org/ Testing comments',
|
||||
'http://www.phpdoc.org/ Testing comments',
|
||||
'Testing comments',
|
||||
'http://www.phpdoc.org/'
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@@ -1,146 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor Method Tag Test
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
/**
|
||||
* Test class for \phpDocumentor\Reflection\DocBlock\Tag\MethodTag
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class MethodTagTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @param string $signature The signature to test.
|
||||
* @param bool $valid Whether the given signature is expected to
|
||||
* be valid.
|
||||
* @param string $expected_name The method name that is expected from this
|
||||
* signature.
|
||||
* @param string $expected_return The return type that is expected from this
|
||||
* signature.
|
||||
* @param bool $paramCount Number of parameters in the signature.
|
||||
* @param string $description The short description mentioned in the
|
||||
* signature.
|
||||
*
|
||||
* @covers \phpDocumentor\Reflection\DocBlock\Tag\MethodTag
|
||||
* @dataProvider getTestSignatures
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConstruct(
|
||||
$signature,
|
||||
$valid,
|
||||
$expected_name,
|
||||
$expected_return,
|
||||
$expected_isStatic,
|
||||
$paramCount,
|
||||
$description
|
||||
) {
|
||||
ob_start();
|
||||
$tag = new MethodTag('method', $signature);
|
||||
$stdout = ob_get_clean();
|
||||
|
||||
$this->assertSame(
|
||||
$valid,
|
||||
empty($stdout),
|
||||
'No error should have been output if the signature is valid'
|
||||
);
|
||||
|
||||
if (!$valid) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->assertEquals($expected_name, $tag->getMethodName());
|
||||
$this->assertEquals($expected_return, $tag->getType());
|
||||
$this->assertEquals($description, $tag->getDescription());
|
||||
$this->assertEquals($expected_isStatic, $tag->isStatic());
|
||||
$this->assertCount($paramCount, $tag->getArguments());
|
||||
}
|
||||
|
||||
public function getTestSignatures()
|
||||
{
|
||||
return array(
|
||||
// TODO: Verify this case
|
||||
// array(
|
||||
// 'foo',
|
||||
// false, 'foo', '', false, 0, ''
|
||||
// ),
|
||||
array(
|
||||
'foo()',
|
||||
true, 'foo', 'void', false, 0, ''
|
||||
),
|
||||
array(
|
||||
'foo() description',
|
||||
true, 'foo', 'void', false, 0, 'description'
|
||||
),
|
||||
array(
|
||||
'int foo()',
|
||||
true, 'foo', 'int', false, 0, ''
|
||||
),
|
||||
array(
|
||||
'int foo() description',
|
||||
true, 'foo', 'int', false, 0, 'description'
|
||||
),
|
||||
array(
|
||||
'int foo($a, $b)',
|
||||
true, 'foo', 'int', false, 2, ''
|
||||
),
|
||||
array(
|
||||
'int foo() foo(int $a, int $b)',
|
||||
true, 'foo', 'int', false, 2, ''
|
||||
),
|
||||
array(
|
||||
'int foo(int $a, int $b)',
|
||||
true, 'foo', 'int', false, 2, ''
|
||||
),
|
||||
array(
|
||||
'null|int foo(int $a, int $b)',
|
||||
true, 'foo', 'null|int', false, 2, ''
|
||||
),
|
||||
array(
|
||||
'int foo(null|int $a, int $b)',
|
||||
true, 'foo', 'int', false, 2, ''
|
||||
),
|
||||
array(
|
||||
'\Exception foo() foo(Exception $a, Exception $b)',
|
||||
true, 'foo', '\Exception', false, 2, ''
|
||||
),
|
||||
array(
|
||||
'int foo() foo(Exception $a, Exception $b) description',
|
||||
true, 'foo', 'int', false, 2, 'description'
|
||||
),
|
||||
array(
|
||||
'int foo() foo(\Exception $a, \Exception $b) description',
|
||||
true, 'foo', 'int', false, 2, 'description'
|
||||
),
|
||||
array(
|
||||
'void()',
|
||||
true, 'void', 'void', false, 0, ''
|
||||
),
|
||||
array(
|
||||
'static foo()',
|
||||
true, 'foo', 'static', false, 0, ''
|
||||
),
|
||||
array(
|
||||
'static void foo()',
|
||||
true, 'foo', 'void', true, 0, ''
|
||||
),
|
||||
array(
|
||||
'static static foo()',
|
||||
true, 'foo', 'static', true, 0, ''
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
@@ -1,118 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor Param tag test.
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
/**
|
||||
* Test class for \phpDocumentor\Reflection\DocBlock\ParamTag
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class ParamTagTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\ParamTag can
|
||||
* understand the @param DocBlock.
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $content
|
||||
* @param string $extractedType
|
||||
* @param string $extractedTypes
|
||||
* @param string $extractedVarName
|
||||
* @param string $extractedDescription
|
||||
*
|
||||
* @covers \phpDocumentor\Reflection\DocBlock\Tag\ParamTag
|
||||
* @dataProvider provideDataForConstructor
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConstructorParsesInputsIntoCorrectFields(
|
||||
$type,
|
||||
$content,
|
||||
$extractedType,
|
||||
$extractedTypes,
|
||||
$extractedVarName,
|
||||
$extractedDescription
|
||||
) {
|
||||
$tag = new ParamTag($type, $content);
|
||||
|
||||
$this->assertEquals($type, $tag->getName());
|
||||
$this->assertEquals($extractedType, $tag->getType());
|
||||
$this->assertEquals($extractedTypes, $tag->getTypes());
|
||||
$this->assertEquals($extractedVarName, $tag->getVariableName());
|
||||
$this->assertEquals($extractedDescription, $tag->getDescription());
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testConstructorParsesInputsIntoCorrectFields()
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provideDataForConstructor()
|
||||
{
|
||||
return array(
|
||||
array('param', 'int', 'int', array('int'), '', ''),
|
||||
array('param', '$bob', '', array(), '$bob', ''),
|
||||
array(
|
||||
'param',
|
||||
'int Number of bobs',
|
||||
'int',
|
||||
array('int'),
|
||||
'',
|
||||
'Number of bobs'
|
||||
),
|
||||
array(
|
||||
'param',
|
||||
'int $bob',
|
||||
'int',
|
||||
array('int'),
|
||||
'$bob',
|
||||
''
|
||||
),
|
||||
array(
|
||||
'param',
|
||||
'int $bob Number of bobs',
|
||||
'int',
|
||||
array('int'),
|
||||
'$bob',
|
||||
'Number of bobs'
|
||||
),
|
||||
array(
|
||||
'param',
|
||||
"int Description \n on multiple lines",
|
||||
'int',
|
||||
array('int'),
|
||||
'',
|
||||
"Description \n on multiple lines"
|
||||
),
|
||||
array(
|
||||
'param',
|
||||
"int \n\$bob Variable name on a new line",
|
||||
'int',
|
||||
array('int'),
|
||||
'$bob',
|
||||
"Variable name on a new line"
|
||||
),
|
||||
array(
|
||||
'param',
|
||||
"\nint \$bob Type on a new line",
|
||||
'int',
|
||||
array('int'),
|
||||
'$bob',
|
||||
"Type on a new line"
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
@@ -1,102 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor Return tag test.
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
/**
|
||||
* Test class for \phpDocumentor\Reflection\DocBlock\ReturnTag
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class ReturnTagTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\ReturnTag can
|
||||
* understand the @return DocBlock.
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $content
|
||||
* @param string $extractedType
|
||||
* @param string $extractedTypes
|
||||
* @param string $extractedDescription
|
||||
*
|
||||
* @covers \phpDocumentor\Reflection\DocBlock\Tag\ReturnTag
|
||||
* @dataProvider provideDataForConstructor
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConstructorParsesInputsIntoCorrectFields(
|
||||
$type,
|
||||
$content,
|
||||
$extractedType,
|
||||
$extractedTypes,
|
||||
$extractedDescription
|
||||
) {
|
||||
$tag = new ReturnTag($type, $content);
|
||||
|
||||
$this->assertEquals($type, $tag->getName());
|
||||
$this->assertEquals($extractedType, $tag->getType());
|
||||
$this->assertEquals($extractedTypes, $tag->getTypes());
|
||||
$this->assertEquals($extractedDescription, $tag->getDescription());
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testConstructorParsesInputsIntoCorrectFields()
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provideDataForConstructor()
|
||||
{
|
||||
return array(
|
||||
array('return', '', '', array(), ''),
|
||||
array('return', 'int', 'int', array('int'), ''),
|
||||
array(
|
||||
'return',
|
||||
'int Number of Bobs',
|
||||
'int',
|
||||
array('int'),
|
||||
'Number of Bobs'
|
||||
),
|
||||
array(
|
||||
'return',
|
||||
'int|double Number of Bobs',
|
||||
'int|double',
|
||||
array('int', 'double'),
|
||||
'Number of Bobs'
|
||||
),
|
||||
array(
|
||||
'return',
|
||||
"int Number of \n Bobs",
|
||||
'int',
|
||||
array('int'),
|
||||
"Number of \n Bobs"
|
||||
),
|
||||
array(
|
||||
'return',
|
||||
" int Number of Bobs",
|
||||
'int',
|
||||
array('int'),
|
||||
"Number of Bobs"
|
||||
),
|
||||
array(
|
||||
'return',
|
||||
"int\nNumber of Bobs",
|
||||
'int',
|
||||
array('int'),
|
||||
"Number of Bobs"
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
@@ -1,86 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor See Tag Test
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @author Daniel O'Connor <daniel.oconnor@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
/**
|
||||
* Test class for \phpDocumentor\Reflection\DocBlock\Tag\SeeTag
|
||||
*
|
||||
* @author Daniel O'Connor <daniel.oconnor@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class SeeTagTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Test that the phpDocumentor_Reflection_DocBlock_Tag_See can create a link
|
||||
* for the @see doc block.
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $content
|
||||
* @param string $exContent
|
||||
* @param string $exReference
|
||||
*
|
||||
* @covers \phpDocumentor\Reflection\DocBlock\Tag\SeeTag
|
||||
* @dataProvider provideDataForConstuctor
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConstructorParesInputsIntoCorrectFields(
|
||||
$type,
|
||||
$content,
|
||||
$exContent,
|
||||
$exDescription,
|
||||
$exReference
|
||||
) {
|
||||
$tag = new SeeTag($type, $content);
|
||||
|
||||
$this->assertEquals($type, $tag->getName());
|
||||
$this->assertEquals($exContent, $tag->getContent());
|
||||
$this->assertEquals($exDescription, $tag->getDescription());
|
||||
$this->assertEquals($exReference, $tag->getReference());
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testConstructorParesInputsIntoCorrectFields
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provideDataForConstuctor()
|
||||
{
|
||||
// $type, $content, $exContent, $exDescription, $exReference
|
||||
return array(
|
||||
array(
|
||||
'see',
|
||||
'Foo::bar()',
|
||||
'Foo::bar()',
|
||||
'',
|
||||
'Foo::bar()'
|
||||
),
|
||||
array(
|
||||
'see',
|
||||
'Foo::bar() Testing',
|
||||
'Foo::bar() Testing',
|
||||
'Testing',
|
||||
'Foo::bar()',
|
||||
),
|
||||
array(
|
||||
'see',
|
||||
'Foo::bar() Testing comments',
|
||||
'Foo::bar() Testing comments',
|
||||
'Testing comments',
|
||||
'Foo::bar()',
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@@ -1,115 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor Since Tag Test
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @author Vasil Rangelov <boen.robot@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
/**
|
||||
* Test class for \phpDocumentor\Reflection\DocBlock\Tag\SinceTag
|
||||
*
|
||||
* @author Vasil Rangelov <boen.robot@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class SinceTagTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\LinkTag can create
|
||||
* a link for the @since doc block.
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $content
|
||||
* @param string $exContent
|
||||
* @param string $exDescription
|
||||
* @param string $exVersion
|
||||
*
|
||||
* @covers \phpDocumentor\Reflection\DocBlock\Tag\SinceTag
|
||||
* @dataProvider provideDataForConstuctor
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConstructorParesInputsIntoCorrectFields(
|
||||
$type,
|
||||
$content,
|
||||
$exContent,
|
||||
$exDescription,
|
||||
$exVersion
|
||||
) {
|
||||
$tag = new SinceTag($type, $content);
|
||||
|
||||
$this->assertEquals($type, $tag->getName());
|
||||
$this->assertEquals($exContent, $tag->getContent());
|
||||
$this->assertEquals($exDescription, $tag->getDescription());
|
||||
$this->assertEquals($exVersion, $tag->getVersion());
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testConstructorParesInputsIntoCorrectFields
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provideDataForConstuctor()
|
||||
{
|
||||
// $type, $content, $exContent, $exDescription, $exVersion
|
||||
return array(
|
||||
array(
|
||||
'since',
|
||||
'1.0 First release.',
|
||||
'1.0 First release.',
|
||||
'First release.',
|
||||
'1.0'
|
||||
),
|
||||
array(
|
||||
'since',
|
||||
"1.0\nFirst release.",
|
||||
"1.0\nFirst release.",
|
||||
'First release.',
|
||||
'1.0'
|
||||
),
|
||||
array(
|
||||
'since',
|
||||
"1.0\nFirst\nrelease.",
|
||||
"1.0\nFirst\nrelease.",
|
||||
"First\nrelease.",
|
||||
'1.0'
|
||||
),
|
||||
array(
|
||||
'since',
|
||||
'Unfinished release',
|
||||
'Unfinished release',
|
||||
'Unfinished release',
|
||||
''
|
||||
),
|
||||
array(
|
||||
'since',
|
||||
'1.0',
|
||||
'1.0',
|
||||
'',
|
||||
'1.0'
|
||||
),
|
||||
array(
|
||||
'since',
|
||||
'GIT: $Id$',
|
||||
'GIT: $Id$',
|
||||
'',
|
||||
'GIT: $Id$'
|
||||
),
|
||||
array(
|
||||
'since',
|
||||
'GIT: $Id$ Dev build',
|
||||
'GIT: $Id$ Dev build',
|
||||
'Dev build',
|
||||
'GIT: $Id$'
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
@@ -1,116 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor Source Tag Test
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @author Vasil Rangelov <boen.robot@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
/**
|
||||
* Test class for \phpDocumentor\Reflection\DocBlock\Tag\SourceTag
|
||||
*
|
||||
* @author Vasil Rangelov <boen.robot@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class SourceTagTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\SourceTag can
|
||||
* understand the @source DocBlock.
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $content
|
||||
* @param string $exContent
|
||||
* @param string $exStartingLine
|
||||
* @param string $exLineCount
|
||||
*
|
||||
* @covers \phpDocumentor\Reflection\DocBlock\Tag\SourceTag
|
||||
* @dataProvider provideDataForConstuctor
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConstructorParesInputsIntoCorrectFields(
|
||||
$type,
|
||||
$content,
|
||||
$exContent,
|
||||
$exDescription,
|
||||
$exStartingLine,
|
||||
$exLineCount
|
||||
) {
|
||||
$tag = new SourceTag($type, $content);
|
||||
|
||||
$this->assertEquals($type, $tag->getName());
|
||||
$this->assertEquals($exContent, $tag->getContent());
|
||||
$this->assertEquals($exDescription, $tag->getDescription());
|
||||
$this->assertEquals($exStartingLine, $tag->getStartingLine());
|
||||
$this->assertEquals($exLineCount, $tag->getLineCount());
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testConstructorParesInputsIntoCorrectFields
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provideDataForConstuctor()
|
||||
{
|
||||
// $type, $content, $exContent, $exDescription, $exStartingLine, $exLineCount
|
||||
return array(
|
||||
array(
|
||||
'source',
|
||||
'2',
|
||||
'2',
|
||||
'',
|
||||
2,
|
||||
null
|
||||
),
|
||||
array(
|
||||
'source',
|
||||
'Testing',
|
||||
'Testing',
|
||||
'Testing',
|
||||
1,
|
||||
null
|
||||
),
|
||||
array(
|
||||
'source',
|
||||
'2 Testing',
|
||||
'2 Testing',
|
||||
'Testing',
|
||||
2,
|
||||
null
|
||||
),
|
||||
array(
|
||||
'source',
|
||||
'2 3 Testing comments',
|
||||
'2 3 Testing comments',
|
||||
'Testing comments',
|
||||
2,
|
||||
3
|
||||
),
|
||||
array(
|
||||
'source',
|
||||
'2 -1 Testing comments',
|
||||
'2 -1 Testing comments',
|
||||
'-1 Testing comments',
|
||||
2,
|
||||
null
|
||||
),
|
||||
array(
|
||||
'source',
|
||||
'-1 1 Testing comments',
|
||||
'-1 1 Testing comments',
|
||||
'-1 1 Testing comments',
|
||||
1,
|
||||
null
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
@@ -1,102 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor Throws tag test.
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
/**
|
||||
* Test class for \phpDocumentor\Reflection\DocBlock\ThrowsTag
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class ThrowsTagTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\ThrowsTag can
|
||||
* understand the @throws DocBlock.
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $content
|
||||
* @param string $extractedType
|
||||
* @param string $extractedTypes
|
||||
* @param string $extractedDescription
|
||||
*
|
||||
* @covers \phpDocumentor\Reflection\DocBlock\Tag\ThrowsTag
|
||||
* @dataProvider provideDataForConstructor
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConstructorParsesInputsIntoCorrectFields(
|
||||
$type,
|
||||
$content,
|
||||
$extractedType,
|
||||
$extractedTypes,
|
||||
$extractedDescription
|
||||
) {
|
||||
$tag = new ThrowsTag($type, $content);
|
||||
|
||||
$this->assertEquals($type, $tag->getName());
|
||||
$this->assertEquals($extractedType, $tag->getType());
|
||||
$this->assertEquals($extractedTypes, $tag->getTypes());
|
||||
$this->assertEquals($extractedDescription, $tag->getDescription());
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testConstructorParsesInputsIntoCorrectFields()
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provideDataForConstructor()
|
||||
{
|
||||
return array(
|
||||
array('throws', '', '', array(), ''),
|
||||
array('throws', 'int', 'int', array('int'), ''),
|
||||
array(
|
||||
'throws',
|
||||
'int Number of Bobs',
|
||||
'int',
|
||||
array('int'),
|
||||
'Number of Bobs'
|
||||
),
|
||||
array(
|
||||
'throws',
|
||||
'int|double Number of Bobs',
|
||||
'int|double',
|
||||
array('int', 'double'),
|
||||
'Number of Bobs'
|
||||
),
|
||||
array(
|
||||
'throws',
|
||||
"int Number of \n Bobs",
|
||||
'int',
|
||||
array('int'),
|
||||
"Number of \n Bobs"
|
||||
),
|
||||
array(
|
||||
'throws',
|
||||
" int Number of Bobs",
|
||||
'int',
|
||||
array('int'),
|
||||
"Number of Bobs"
|
||||
),
|
||||
array(
|
||||
'throws',
|
||||
"int\nNumber of Bobs",
|
||||
'int',
|
||||
array('int'),
|
||||
"Number of Bobs"
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user