pax_global_header 0000666 0000000 0000000 00000000064 12431365310 0014510 g ustar 00root root 0000000 0000000 52 comment=fc40c3f604ac2287eb5c314174d5109b2c699372
Reflection-1.0.7/ 0000775 0000000 0000000 00000000000 12431365310 0013607 5 ustar 00root root 0000000 0000000 Reflection-1.0.7/.gitattributes 0000664 0000000 0000000 00000000021 12431365310 0016473 0 ustar 00root root 0000000 0000000 *.php text eol=lf Reflection-1.0.7/.gitignore 0000664 0000000 0000000 00000000015 12431365310 0015573 0 ustar 00root root 0000000 0000000 .idea
vendor
Reflection-1.0.7/.travis.yml 0000664 0000000 0000000 00000001122 12431365310 0015714 0 ustar 00root root 0000000 0000000 language: php
php:
- 5.3.3
- 5.3
- 5.4
- 5.5
- 5.6
- hhvm
- hhvm-nightly
matrix:
allow_failures:
- php: hhvm
- php: hhvm-nightly
script:
- vendor/bin/phpunit
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
notifications:
irc: "irc.freenode.org#phpdocumentor"
email:
- mike.vanriel@naenius.com
- ashnazg@php.net
- boen.robot@gmail.com
Reflection-1.0.7/README.md 0000664 0000000 0000000 00000000315 12431365310 0015065 0 ustar 00root root 0000000 0000000 Reflection [](http://travis-ci.org/phpDocumentor/Reflection)
==========
Reflection library to do Static Analysis for PHP Projects
Reflection-1.0.7/composer.json 0000664 0000000 0000000 00000001516 12431365310 0016334 0 ustar 00root root 0000000 0000000 {
"name": "phpdocumentor/reflection",
"description": "Reflection library to do Static Analysis for PHP Projects",
"keywords": ["phpdoc", "phpDocumentor", "reflection", "static analysis"],
"homepage": "http://www.phpdoc.org",
"license": "MIT",
"autoload": {
"psr-0": {
"phpDocumentor": ["src/", "tests/unit/", "tests/mocks/"]
}
},
"require": {
"php": ">=5.3.3",
"psr/log": "~1.0",
"nikic/php-parser": "~0.9.4",
"phpdocumentor/reflection-docblock": "~2.0"
},
"suggests": {
"symfony/event-dispatcher": "~2.1"
},
"require-dev": {
"behat/behat": "~2.4",
"phpunit/phpunit": "~4.0",
"mockery/mockery": "~0.8"
},
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
}
}
Reflection-1.0.7/composer.lock 0000664 0000000 0000000 00000147366 12431365310 0016331 0 ustar 00root root 0000000 0000000 {
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "bb115398316625e0a5cf7baace1450f7",
"packages": [
{
"name": "nikic/php-parser",
"version": "v0.9.5",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
"reference": "ef70767475434bdb3615b43c327e2cae17ef12eb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/ef70767475434bdb3615b43c327e2cae17ef12eb",
"reference": "ef70767475434bdb3615b43c327e2cae17ef12eb",
"shasum": ""
},
"require": {
"ext-tokenizer": "*",
"php": ">=5.2"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "0.9-dev"
}
},
"autoload": {
"psr-0": {
"PHPParser": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Nikita Popov"
}
],
"description": "A PHP parser written in PHP",
"keywords": [
"parser",
"php"
],
"time": "2014-07-23 18:24:17"
},
{
"name": "phpdocumentor/reflection-docblock",
"version": "2.0.3",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
"reference": "38743b677965c48a637097b2746a281264ae2347"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/38743b677965c48a637097b2746a281264ae2347",
"reference": "38743b677965c48a637097b2746a281264ae2347",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "3.7.*@stable"
},
"suggest": {
"dflydev/markdown": "1.0.*",
"erusev/parsedown": "~0.7"
},
"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": "2014-08-09 10:27:07"
},
{
"name": "psr/log",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/log.git",
"reference": "fe0936ee26643249e916849d48e3a51d5f5e278b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b",
"reference": "fe0936ee26643249e916849d48e3a51d5f5e278b",
"shasum": ""
},
"type": "library",
"autoload": {
"psr-0": {
"Psr\\Log\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for logging libraries",
"keywords": [
"log",
"psr",
"psr-3"
],
"time": "2012-12-21 11:40:51"
}
],
"packages-dev": [
{
"name": "behat/behat",
"version": "v2.5.3",
"source": {
"type": "git",
"url": "https://github.com/Behat/Behat.git",
"reference": "c3a105a3c0457df919879c72b63b910e63739e51"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Behat/Behat/zipball/c3a105a3c0457df919879c72b63b910e63739e51",
"reference": "c3a105a3c0457df919879c72b63b910e63739e51",
"shasum": ""
},
"require": {
"behat/gherkin": "~2.3.0",
"php": ">=5.3.1",
"symfony/config": "~2.0",
"symfony/console": "~2.0",
"symfony/dependency-injection": "~2.0",
"symfony/event-dispatcher": "~2.0",
"symfony/finder": "~2.0",
"symfony/translation": "~2.0",
"symfony/yaml": "~2.0"
},
"require-dev": {
"phpunit/phpunit": "~3.7.19"
},
"suggest": {
"behat/mink-extension": "for integration with Mink testing framework",
"behat/symfony2-extension": "for integration with Symfony2 web framework",
"behat/yii-extension": "for integration with Yii web framework"
},
"bin": [
"bin/behat"
],
"type": "library",
"autoload": {
"psr-0": {
"Behat\\Behat": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Konstantin Kudryashov",
"email": "ever.zet@gmail.com",
"homepage": "http://everzet.com"
}
],
"description": "Scenario-oriented BDD framework for PHP 5.3",
"homepage": "http://behat.org/",
"keywords": [
"BDD",
"Behat",
"Symfony2"
],
"time": "2014-04-26 16:55:16"
},
{
"name": "behat/gherkin",
"version": "v2.3.5",
"source": {
"type": "git",
"url": "https://github.com/Behat/Gherkin.git",
"reference": "2b33963da5525400573560c173ab5c9c057e1852"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Behat/Gherkin/zipball/2b33963da5525400573560c173ab5c9c057e1852",
"reference": "2b33963da5525400573560c173ab5c9c057e1852",
"shasum": ""
},
"require": {
"php": ">=5.3.1",
"symfony/finder": "~2.0"
},
"require-dev": {
"symfony/config": "~2.0",
"symfony/translation": "~2.0",
"symfony/yaml": "~2.0"
},
"suggest": {
"symfony/config": "If you want to use Config component to manage resources",
"symfony/translation": "If you want to use Symfony2 translations adapter",
"symfony/yaml": "If you want to parse features, represented in YAML files"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-develop": "2.2-dev"
}
},
"autoload": {
"psr-0": {
"Behat\\Gherkin": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Konstantin Kudryashov",
"email": "ever.zet@gmail.com",
"homepage": "http://everzet.com"
}
],
"description": "Gherkin DSL parser for PHP 5.3",
"homepage": "http://behat.org/",
"keywords": [
"BDD",
"Behat",
"DSL",
"Symfony2",
"parser"
],
"time": "2013-10-15 11:22:17"
},
{
"name": "mockery/mockery",
"version": "0.9.1",
"source": {
"type": "git",
"url": "https://github.com/padraic/mockery.git",
"reference": "17f63ee40ed14a8afb7ba1f0ae15cc4491d719d1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/padraic/mockery/zipball/17f63ee40ed14a8afb7ba1f0ae15cc4491d719d1",
"reference": "17f63ee40ed14a8afb7ba1f0ae15cc4491d719d1",
"shasum": ""
},
"require": {
"lib-pcre": ">=7.0",
"php": ">=5.3.2"
},
"require-dev": {
"hamcrest/hamcrest-php": "~1.1",
"phpunit/phpunit": "~4.0",
"satooshi/php-coveralls": "~0.7@dev"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "0.9.x-dev"
}
},
"autoload": {
"psr-0": {
"Mockery": "library/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Pádraic Brady",
"email": "padraic.brady@gmail.com",
"homepage": "http://blog.astrumfutura.com"
},
{
"name": "Dave Marshall",
"email": "dave.marshall@atstsolutions.co.uk",
"homepage": "http://davedevelopment.co.uk"
}
],
"description": "Mockery is a simple yet flexible PHP mock object framework for use in unit testing with PHPUnit, PHPSpec or any other testing framework. Its core goal is to offer a test double framework with a succint API capable of clearly defining all possible object operations and interactions using a human readable Domain Specific Language (DSL). Designed as a drop in alternative to PHPUnit's phpunit-mock-objects library, Mockery is easy to integrate with PHPUnit and can operate alongside phpunit-mock-objects without the World ending.",
"homepage": "http://github.com/padraic/mockery",
"keywords": [
"BDD",
"TDD",
"library",
"mock",
"mock objects",
"mockery",
"stub",
"test",
"test double",
"testing"
],
"time": "2014-05-02 12:16:45"
},
{
"name": "ocramius/instantiator",
"version": "1.1.2",
"source": {
"type": "git",
"url": "https://github.com/Ocramius/Instantiator.git",
"reference": "a7abbb5fc9df6e7126af741dd6c140d1a7369435"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Ocramius/Instantiator/zipball/a7abbb5fc9df6e7126af741dd6c140d1a7369435",
"reference": "a7abbb5fc9df6e7126af741dd6c140d1a7369435",
"shasum": ""
},
"require": {
"ocramius/lazy-map": "1.0.*",
"php": "~5.3"
},
"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": "2.0.x-dev"
}
},
"autoload": {
"psr-0": {
"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/Ocramius/Instantiator",
"keywords": [
"constructor",
"instantiate"
],
"time": "2014-08-14 15:10:55"
},
{
"name": "ocramius/lazy-map",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/Ocramius/LazyMap.git",
"reference": "7fe3d347f5e618bcea7d39345ff83f3651d8b752"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Ocramius/LazyMap/zipball/7fe3d347f5e618bcea7d39345ff83f3651d8b752",
"reference": "7fe3d347f5e618bcea7d39345ff83f3651d8b752",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"athletic/athletic": "~0.1.6",
"phpmd/phpmd": "1.5.*",
"phpunit/phpunit": ">=3.7",
"satooshi/php-coveralls": "~0.6",
"squizlabs/php_codesniffer": "1.4.*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-0": {
"LazyMap\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Marco Pivetta",
"email": "ocramius@gmail.com",
"homepage": "http://ocramius.github.com/",
"role": "Developer"
}
],
"description": "A library that provides lazy instantiation logic for a map of objects",
"homepage": "https://github.com/Ocramius/LazyMap",
"keywords": [
"lazy",
"lazy instantiation",
"lazy loading",
"map",
"service location"
],
"time": "2013-11-09 22:30:54"
},
{
"name": "phpunit/php-code-coverage",
"version": "2.0.10",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "6d196af48e8c100a3ae881940123e693da5a9217"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/6d196af48e8c100a3ae881940123e693da5a9217",
"reference": "6d196af48e8c100a3ae881940123e693da5a9217",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"phpunit/php-file-iterator": "~1.3.1",
"phpunit/php-text-template": "~1.2.0",
"phpunit/php-token-stream": "~1.2.2",
"sebastian/environment": "~1.0.0",
"sebastian/version": "~1.0.3"
},
"require-dev": {
"ext-xdebug": ">=2.1.4",
"phpunit/phpunit": "~4.0.14"
},
"suggest": {
"ext-dom": "*",
"ext-xdebug": ">=2.2.1",
"ext-xmlwriter": "*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"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": "2014-08-06 06:39:42"
},
{
"name": "phpunit/php-file-iterator",
"version": "1.3.4",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-file-iterator.git",
"reference": "acd690379117b042d1c8af1fafd61bde001bf6bb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/acd690379117b042d1c8af1fafd61bde001bf6bb",
"reference": "acd690379117b042d1c8af1fafd61bde001bf6bb",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"autoload": {
"classmap": [
"File/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"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": "2013-10-10 15:34:57"
},
{
"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.2.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-token-stream.git",
"reference": "ad4e1e23ae01b483c16f600ff1bebec184588e32"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/ad4e1e23ae01b483c16f600ff1bebec184588e32",
"reference": "ad4e1e23ae01b483c16f600ff1bebec184588e32",
"shasum": ""
},
"require": {
"ext-tokenizer": "*",
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2-dev"
}
},
"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": "Wrapper around PHP's tokenizer extension.",
"homepage": "https://github.com/sebastianbergmann/php-token-stream/",
"keywords": [
"tokenizer"
],
"time": "2014-03-03 05:10:30"
},
{
"name": "phpunit/phpunit",
"version": "4.2.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "a33fa68ece9f8c68589bfc2da8d2794e27b820bc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a33fa68ece9f8c68589bfc2da8d2794e27b820bc",
"reference": "a33fa68ece9f8c68589bfc2da8d2794e27b820bc",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-json": "*",
"ext-pcre": "*",
"ext-reflection": "*",
"ext-spl": "*",
"php": ">=5.3.3",
"phpunit/php-code-coverage": "~2.0",
"phpunit/php-file-iterator": "~1.3.1",
"phpunit/php-text-template": "~1.2",
"phpunit/php-timer": "~1.0.2",
"phpunit/phpunit-mock-objects": "~2.2",
"sebastian/comparator": "~1.0",
"sebastian/diff": "~1.1",
"sebastian/environment": "~1.0",
"sebastian/exporter": "~1.0",
"sebastian/version": "~1.0",
"symfony/yaml": "~2.0"
},
"suggest": {
"phpunit/php-invoker": "~1.1"
},
"bin": [
"phpunit"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.2.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
"",
"../../symfony/yaml/"
],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "The PHP Unit Testing framework.",
"homepage": "http://www.phpunit.de/",
"keywords": [
"phpunit",
"testing",
"xunit"
],
"time": "2014-08-18 05:12:30"
},
{
"name": "phpunit/phpunit-mock-objects",
"version": "2.2.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
"reference": "42e589e08bc86e3e9bdf20d385e948347788505b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/42e589e08bc86e3e9bdf20d385e948347788505b",
"reference": "42e589e08bc86e3e9bdf20d385e948347788505b",
"shasum": ""
},
"require": {
"ocramius/instantiator": "~1.0",
"php": ">=5.3.3",
"phpunit/php-text-template": "~1.2"
},
"require-dev": {
"phpunit/phpunit": "4.2.*@dev"
},
"suggest": {
"ext-soap": "*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.2.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"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": "2014-08-02 13:50:58"
},
{
"name": "sebastian/comparator",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/comparator.git",
"reference": "f7069ee51fa9fb6c038e16a9d0e3439f5449dcf2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/f7069ee51fa9fb6c038e16a9d0e3439f5449dcf2",
"reference": "f7069ee51fa9fb6c038e16a9d0e3439f5449dcf2",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"sebastian/diff": "~1.1",
"sebastian/exporter": "~1.0"
},
"require-dev": {
"phpunit/phpunit": "~4.1"
},
"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": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
},
{
"name": "Jeff Welch",
"email": "whatthejeff@gmail.com"
},
{
"name": "Volker Dusch",
"email": "github@wallbash.com"
},
{
"name": "Bernhard Schussek",
"email": "bschussek@2bepublished.at"
}
],
"description": "Provides the functionality to compare PHP values for equality",
"homepage": "http://www.github.com/sebastianbergmann/comparator",
"keywords": [
"comparator",
"compare",
"equality"
],
"time": "2014-05-02 07:05:58"
},
{
"name": "sebastian/diff",
"version": "1.1.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/diff.git",
"reference": "1e091702a5a38e6b4c1ba9ca816e3dd343df2e2d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/1e091702a5a38e6b4c1ba9ca816e3dd343df2e2d",
"reference": "1e091702a5a38e6b4c1ba9ca816e3dd343df2e2d",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.1-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
},
{
"name": "Kore Nordmann",
"email": "mail@kore-nordmann.de"
}
],
"description": "Diff implementation",
"homepage": "http://www.github.com/sebastianbergmann/diff",
"keywords": [
"diff"
],
"time": "2013-08-03 16:46:33"
},
{
"name": "sebastian/environment",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/environment.git",
"reference": "79517609ec01139cd7e9fded0dd7ce08c952ef6a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/79517609ec01139cd7e9fded0dd7ce08c952ef6a",
"reference": "79517609ec01139cd7e9fded0dd7ce08c952ef6a",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "4.0.*@dev"
},
"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": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "Provides functionality to handle HHVM/PHP environments",
"homepage": "http://www.github.com/sebastianbergmann/environment",
"keywords": [
"Xdebug",
"environment",
"hhvm"
],
"time": "2014-02-18 16:17:19"
},
{
"name": "sebastian/exporter",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/exporter.git",
"reference": "1f9a98e6f5dfe0524cb8c6166f7c82f3e9ae1529"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/1f9a98e6f5dfe0524cb8c6166f7c82f3e9ae1529",
"reference": "1f9a98e6f5dfe0524cb8c6166f7c82f3e9ae1529",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "4.0.*@dev"
},
"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": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
},
{
"name": "Jeff Welch",
"email": "whatthejeff@gmail.com"
},
{
"name": "Volker Dusch",
"email": "github@wallbash.com"
},
{
"name": "Adam Harvey",
"email": "aharvey@php.net",
"role": "Lead"
},
{
"name": "Bernhard Schussek",
"email": "bschussek@2bepublished.at"
}
],
"description": "Provides the functionality to export PHP variables for visualization",
"homepage": "http://www.github.com/sebastianbergmann/exporter",
"keywords": [
"export",
"exporter"
],
"time": "2014-02-16 08:26:31"
},
{
"name": "sebastian/version",
"version": "1.0.3",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/version.git",
"reference": "b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/version/zipball/b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43",
"reference": "b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43",
"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": "2014-03-07 15:35:33"
},
{
"name": "symfony/config",
"version": "v2.5.3",
"target-dir": "Symfony/Component/Config",
"source": {
"type": "git",
"url": "https://github.com/symfony/Config.git",
"reference": "8d044668c7ccb4ade684e368d910e3aadcff6f6c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Config/zipball/8d044668c7ccb4ade684e368d910e3aadcff6f6c",
"reference": "8d044668c7ccb4ade684e368d910e3aadcff6f6c",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"symfony/filesystem": "~2.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.5-dev"
}
},
"autoload": {
"psr-0": {
"Symfony\\Component\\Config\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
},
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
}
],
"description": "Symfony Config Component",
"homepage": "http://symfony.com",
"time": "2014-08-05 09:00:40"
},
{
"name": "symfony/console",
"version": "v2.5.3",
"target-dir": "Symfony/Component/Console",
"source": {
"type": "git",
"url": "https://github.com/symfony/Console.git",
"reference": "cd2d1e4bac2206b337326b0140ff475fe9ad5f63"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Console/zipball/cd2d1e4bac2206b337326b0140ff475fe9ad5f63",
"reference": "cd2d1e4bac2206b337326b0140ff475fe9ad5f63",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"psr/log": "~1.0",
"symfony/event-dispatcher": "~2.1"
},
"suggest": {
"psr/log": "For using the console logger",
"symfony/event-dispatcher": ""
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.5-dev"
}
},
"autoload": {
"psr-0": {
"Symfony\\Component\\Console\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
},
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
}
],
"description": "Symfony Console Component",
"homepage": "http://symfony.com",
"time": "2014-08-05 09:00:40"
},
{
"name": "symfony/dependency-injection",
"version": "v2.5.3",
"target-dir": "Symfony/Component/DependencyInjection",
"source": {
"type": "git",
"url": "https://github.com/symfony/DependencyInjection.git",
"reference": "54529fdc797a88c030441773adadcc759bb102c2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/DependencyInjection/zipball/54529fdc797a88c030441773adadcc759bb102c2",
"reference": "54529fdc797a88c030441773adadcc759bb102c2",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"symfony/config": "~2.2",
"symfony/expression-language": "~2.4",
"symfony/yaml": "~2.0"
},
"suggest": {
"symfony/config": "",
"symfony/proxy-manager-bridge": "Generate service proxies to lazy load them",
"symfony/yaml": ""
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.5-dev"
}
},
"autoload": {
"psr-0": {
"Symfony\\Component\\DependencyInjection\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
},
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
}
],
"description": "Symfony DependencyInjection Component",
"homepage": "http://symfony.com",
"time": "2014-08-06 06:44:37"
},
{
"name": "symfony/event-dispatcher",
"version": "v2.5.3",
"target-dir": "Symfony/Component/EventDispatcher",
"source": {
"type": "git",
"url": "https://github.com/symfony/EventDispatcher.git",
"reference": "8faf5cc7e80fde74a650a36e60d32ce3c3e0457b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/8faf5cc7e80fde74a650a36e60d32ce3c3e0457b",
"reference": "8faf5cc7e80fde74a650a36e60d32ce3c3e0457b",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"psr/log": "~1.0",
"symfony/config": "~2.0",
"symfony/dependency-injection": "~2.0",
"symfony/stopwatch": "~2.2"
},
"suggest": {
"symfony/dependency-injection": "",
"symfony/http-kernel": ""
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.5-dev"
}
},
"autoload": {
"psr-0": {
"Symfony\\Component\\EventDispatcher\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
},
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
}
],
"description": "Symfony EventDispatcher Component",
"homepage": "http://symfony.com",
"time": "2014-07-28 13:20:46"
},
{
"name": "symfony/filesystem",
"version": "v2.5.3",
"target-dir": "Symfony/Component/Filesystem",
"source": {
"type": "git",
"url": "https://github.com/symfony/Filesystem.git",
"reference": "c1309b0ee195ad264a4314435bdaecdfacb8ae9c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Filesystem/zipball/c1309b0ee195ad264a4314435bdaecdfacb8ae9c",
"reference": "c1309b0ee195ad264a4314435bdaecdfacb8ae9c",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.5-dev"
}
},
"autoload": {
"psr-0": {
"Symfony\\Component\\Filesystem\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
},
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
}
],
"description": "Symfony Filesystem Component",
"homepage": "http://symfony.com",
"time": "2014-07-09 09:05:48"
},
{
"name": "symfony/finder",
"version": "v2.5.3",
"target-dir": "Symfony/Component/Finder",
"source": {
"type": "git",
"url": "https://github.com/symfony/Finder.git",
"reference": "090fe4eaff414d8f2171c7a4748ea868d530775f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Finder/zipball/090fe4eaff414d8f2171c7a4748ea868d530775f",
"reference": "090fe4eaff414d8f2171c7a4748ea868d530775f",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.5-dev"
}
},
"autoload": {
"psr-0": {
"Symfony\\Component\\Finder\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
},
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
}
],
"description": "Symfony Finder Component",
"homepage": "http://symfony.com",
"time": "2014-07-28 13:20:46"
},
{
"name": "symfony/translation",
"version": "v2.5.3",
"target-dir": "Symfony/Component/Translation",
"source": {
"type": "git",
"url": "https://github.com/symfony/Translation.git",
"reference": "ae573e45b099b1e2d332930ac626cd4270e09539"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Translation/zipball/ae573e45b099b1e2d332930ac626cd4270e09539",
"reference": "ae573e45b099b1e2d332930ac626cd4270e09539",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"symfony/config": "~2.0",
"symfony/yaml": "~2.2"
},
"suggest": {
"symfony/config": "",
"symfony/yaml": ""
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.5-dev"
}
},
"autoload": {
"psr-0": {
"Symfony\\Component\\Translation\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
},
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
}
],
"description": "Symfony Translation Component",
"homepage": "http://symfony.com",
"time": "2014-07-28 13:20:46"
},
{
"name": "symfony/yaml",
"version": "v2.5.3",
"target-dir": "Symfony/Component/Yaml",
"source": {
"type": "git",
"url": "https://github.com/symfony/Yaml.git",
"reference": "5a75366ae9ca8b4792cd0083e4ca4dff9fe96f1f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Yaml/zipball/5a75366ae9ca8b4792cd0083e4ca4dff9fe96f1f",
"reference": "5a75366ae9ca8b4792cd0083e4ca4dff9fe96f1f",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.5-dev"
}
},
"autoload": {
"psr-0": {
"Symfony\\Component\\Yaml\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
},
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
}
],
"description": "Symfony Yaml Component",
"homepage": "http://symfony.com",
"time": "2014-08-05 09:00:40"
}
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"platform": {
"php": ">=5.3.3"
},
"platform-dev": []
}
Reflection-1.0.7/phpunit.xml.dist 0000664 0000000 0000000 00000001131 12431365310 0016756 0 ustar 00root root 0000000 0000000
./tests/unit/
src/phpDocumentor
Reflection-1.0.7/src/ 0000775 0000000 0000000 00000000000 12431365310 0014376 5 ustar 00root root 0000000 0000000 Reflection-1.0.7/src/phpDocumentor/ 0000775 0000000 0000000 00000000000 12431365310 0017225 5 ustar 00root root 0000000 0000000 Reflection-1.0.7/src/phpDocumentor/Reflection/ 0000775 0000000 0000000 00000000000 12431365310 0021317 5 ustar 00root root 0000000 0000000 Reflection-1.0.7/src/phpDocumentor/Reflection/BaseReflector.php 0000664 0000000 0000000 00000017743 12431365310 0024564 0 ustar 00root root 0000000 0000000
* @copyright 2010-2012 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 Exception;
use InvalidArgumentException;
use phpDocumentor\Event\Dispatcher;
use phpDocumentor\Reflection\DocBlock;
use phpDocumentor\Reflection\DocBlock\Context;
use phpDocumentor\Reflection\DocBlock\Location;
use phpDocumentor\Reflection\Event\PostDocBlockExtractionEvent;
use Psr\Log\LogLevel;
use PHPParser_Node_Expr;
use PHPParser_Node_Stmt;
use PHPParser_NodeAbstract;
use PHPParser_PrettyPrinterAbstract;
/**
* Basic reflection providing support for events and basic properties as a
* DocBlock and names.
*
* @author Mike van Riel
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
abstract class BaseReflector extends ReflectionAbstract
{
/** @var PHPParser_Node_Stmt */
protected $node;
/**
* The package name that is passed on by the parent Reflector.
*
* May be overwritten and should be passed on to children supporting
* packages.
*
* @var string
*/
protected $default_package_name = '';
/**
* PHP AST pretty printer used to get representations of values.
*
* @var PHPParser_PrettyPrinterAbstract
*/
protected static $prettyPrinter = null;
/**
* Initializes this reflector with the correct node as produced by
* PHP-Parser.
*
* @param PHPParser_NodeAbstract $node
* @param Context $context
*
* @link http://github.com/nikic/PHP-Parser
*/
public function __construct(PHPParser_NodeAbstract $node, Context $context)
{
$this->node = $node;
$context->setLSEN($this->getLSEN());
$this->context = $context;
}
/**
* Returns the current PHP-Parser node that holds more detailed information
* about the reflected object. e.g. position in the file and further attributes.
* @return PHPParser_Node_Stmt|PHPParser_NodeAbstract
*/
public function getNode()
{
return $this->node;
}
/**
* Sets the name for the namespace.
*
* @param string $namespace
*
* @throws InvalidArgumentException if something other than a string is
* passed.
*
* @return void
*/
public function setNamespace($namespace)
{
if (!is_string($namespace)) {
throw new InvalidArgumentException(
'Expected a string for the namespace'
);
}
$this->context->setNamespace($namespace);
}
/**
* Returns the parsed DocBlock.
*
* @return DocBlock|null
*/
public function getDocBlock()
{
return $this->extractDocBlock($this->node);
}
/**
* Extracts a parsed DocBlock from an object.
*
* @param object $node Any object with a "getDocComment()" method.
*
* @return DocBlock|null
*/
protected function extractDocBlock($node)
{
$doc_block = null;
$comment = $node->getDocComment();
if ($comment) {
try {
$doc_block = new DocBlock(
(string) $comment,
$this->context,
new Location($comment->getLine())
);
} catch (Exception $e) {
$this->log($e->getMessage(), LogLevel::CRITICAL);
}
}
if (class_exists('phpDocumentor\Event\Dispatcher')) {
Dispatcher::getInstance()->dispatch(
'reflection.docblock-extraction.post',
PostDocBlockExtractionEvent
::createInstance($this)->setDocblock($doc_block)
);
}
return $doc_block;
}
/**
* Returns the name for this Reflector instance.
*
* @return string
*/
public function getName()
{
if (isset($this->node->namespacedName)) {
return '\\'.implode('\\', $this->node->namespacedName->parts);
}
return $this->getShortName();
}
/**
* Returns the last component of a namespaced name as a short form.
*
* @return string
*/
public function getShortName()
{
return isset($this->node->name)
? $this->node->name
: (string) $this->node;
}
/**
* Gets the LSEN.
*
* Returns this element's Local Structural Element Name (LSEN). This name
* consistents of the element's short name, along with punctuation that
* hints at the kind of structural element. If the structural element is
* part of a type (i.e. an interface/trait/class' property/method/constant),
* it also contains the name of the owning type.
*
* @return string
*/
public function getLSEN()
{
return '';
}
/**
* Returns the namespace name for this object.
*
* If this object does not have a namespace then the word 'global' is
* returned to indicate a global namespace.
*
* @return string
*/
public function getNamespace()
{
if (!$this->node->namespacedName) {
return $this->context->getNamespace();
}
$parts = $this->node->namespacedName->parts;
array_pop($parts);
$namespace = implode('\\', $parts);
return $namespace ? $namespace : 'global';
}
/**
* Returns a listing of namespace aliases where the key represents the alias
* and the value the Fully Qualified Namespace Name.
*
* @return string[]
*/
public function getNamespaceAliases()
{
return $this->context->getNamespaceAliases();
}
/**
* Sets a listing of namespace aliases.
*
* The keys represents the alias name and the value the
* Fully Qualified Namespace Name (FQNN).
*
* @param string[] $aliases
*
* @return void
*/
public function setNamespaceAliases(array $aliases)
{
$this->context->setNamespaceAliases($aliases);
}
/**
* Sets the Fully Qualified Namespace Name (FQNN) for an alias.
*
* @param string $alias
* @param string $fqnn
*
* @return void
*/
public function setNamespaceAlias($alias, $fqnn)
{
$this->context->setNamespaceAlias($alias, $fqnn);
}
/**
* Returns the line number where this object starts.
*
* @return int
*/
public function getLinenumber()
{
return $this->node->getLine();
}
/**
* Sets the default package name for this object.
*
* If the DocBlock contains a different package name then that overrides
* this package name.
*
* @param string $default_package_name The name of the package as defined
* in the PHPDoc Standard.
*
* @return void
*/
public function setDefaultPackageName($default_package_name)
{
$this->default_package_name = $default_package_name;
}
/**
* Returns the package name that is default for this element.
*
* This value may change after the DocBlock is interpreted. If that contains
* a package tag then that tag overrides the Default package name.
*
* @return string
*/
public function getDefaultPackageName()
{
return $this->default_package_name;
}
/**
* Returns a simple human readable output for a value.
*
* @param PHPParser_Node_Expr $value The value node as provided by
* PHP-Parser.
*
* @return string
*/
protected function getRepresentationOfValue(
PHPParser_Node_Expr $value = null
) {
if (null === $value) {
return '';
}
if (!self::$prettyPrinter) {
self::$prettyPrinter = new PrettyPrinter();
}
return self::$prettyPrinter->prettyPrintExpr($value);
}
}
Reflection-1.0.7/src/phpDocumentor/Reflection/ClassReflector.php 0000664 0000000 0000000 00000004617 12431365310 0024753 0 ustar 00root root 0000000 0000000
* @copyright 2010-2012 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 PHPParser_Node_Name;
use PHPParser_Node_Stmt_Class;
use PHPParser_Node_Stmt_TraitUse;
/**
* Provides static reflection for a class.
*
* @author Mike van Riel
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
class ClassReflector extends InterfaceReflector
{
/** @var \PHPParser_Node_Stmt_Class */
protected $node;
/** @var string[] */
protected $traits = array();
public function parseSubElements()
{
/** @var \PHPParser_Node_Stmt_TraitUse $stmt */
foreach ($this->node->stmts as $stmt) {
if ($stmt instanceof \PHPParser_Node_Stmt_TraitUse) {
foreach ($stmt->traits as $trait) {
$this->traits[] = '\\' . (string) $trait;
}
}
}
parent::parseSubElements();
}
/**
* Returns whether this is an abstract class.
*
* @return bool
*/
public function isAbstract()
{
return (bool) ($this->node->type & PHPParser_Node_Stmt_Class::MODIFIER_ABSTRACT);
}
/**
* Returns whether this class is final and thus cannot be extended.
*
* @return bool
*/
public function isFinal()
{
return (bool) ($this->node->type & PHPParser_Node_Stmt_Class::MODIFIER_FINAL);
}
/**
* Returns a list of the names of traits used in this class.
*
* @return string[]
*/
public function getTraits()
{
return $this->traits;
}
public function getParentClass()
{
return $this->node->extends ? '\\'.(string) $this->node->extends : '';
}
/**
* BC Break: used to be getParentInterfaces
*
* @return string[] Names of interfaces the class implements.
*/
public function getInterfaces()
{
$names = array();
if ($this->node->implements) {
/** @var PHPParser_Node_Name */
foreach ($this->node->implements as $node) {
$names[] = '\\'.(string) $node;
}
}
return $names;
}
}
Reflection-1.0.7/src/phpDocumentor/Reflection/ClassReflector/ 0000775 0000000 0000000 00000000000 12431365310 0024232 5 ustar 00root root 0000000 0000000 Reflection-1.0.7/src/phpDocumentor/Reflection/ClassReflector/ConstantReflector.php 0000664 0000000 0000000 00000002222 12431365310 0030400 0 ustar 00root root 0000000 0000000
* @copyright 2010-2012 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\ClassReflector;
use phpDocumentor\Reflection\BaseReflector;
use phpDocumentor\Reflection\ConstantReflector as BaseConstantReflector;
use phpDocumentor\Reflection\DocBlock\Context;
use PHPParser_Node_Const;
use PHPParser_Node_Stmt_ClassConst;
class ConstantReflector extends BaseConstantReflector
{
/** @var PHPParser_Node_Stmt_ClassConst */
protected $constant;
/**
* Registers the Constant Statement and Node with this reflector.
*
* @param PHPParser_Node_Stmt_Const $stmt
* @param Context $context
* @param PHPParser_Node_Const $node
*/
public function __construct(
PHPParser_Node_Stmt_ClassConst $stmt,
Context $context,
PHPParser_Node_Const $node
) {
BaseReflector::__construct($node, $context);
$this->constant = $stmt;
}
}
Reflection-1.0.7/src/phpDocumentor/Reflection/ClassReflector/MethodReflector.php 0000664 0000000 0000000 00000003542 12431365310 0030035 0 ustar 00root root 0000000 0000000
* @copyright 2010-2012 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\ClassReflector;
use phpDocumentor\Reflection\FunctionReflector;
use PHPParser_Node_Stmt_Class;
use PHPParser_Node_Stmt_ClassMethod;
class MethodReflector extends FunctionReflector
{
/** @var PHPParser_Node_Stmt_ClassMethod */
protected $node;
/**
* Returns the visibility for this item.
*
* The returned value should match either of the following:
*
* * public
* * protected
* * private
*
* If a method has no visibility set in the class definition this method
* will return 'public'.
*
* @return string
*/
public function getVisibility()
{
if ($this->node->type & PHPParser_Node_Stmt_Class::MODIFIER_PROTECTED) {
return 'protected';
}
if ($this->node->type & PHPParser_Node_Stmt_Class::MODIFIER_PRIVATE) {
return 'private';
}
return 'public';
}
/**
* Returns whether this method is static.
*
* @return bool
*/
public function isAbstract()
{
return (bool) ($this->node->type & PHPParser_Node_Stmt_Class::MODIFIER_ABSTRACT);
}
/**
* Returns whether this method is static.
*
* @return bool
*/
public function isStatic()
{
return (bool) ($this->node->type & PHPParser_Node_Stmt_Class::MODIFIER_STATIC);
}
/**
* Returns whether this method is final.
*
* @return bool
*/
public function isFinal()
{
return (bool) ($this->node->type & PHPParser_Node_Stmt_Class::MODIFIER_FINAL);
}
}
Reflection-1.0.7/src/phpDocumentor/Reflection/ClassReflector/PropertyReflector.php 0000664 0000000 0000000 00000005067 12431365310 0030445 0 ustar 00root root 0000000 0000000
* @copyright 2010-2012 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\ClassReflector;
use phpDocumentor\Reflection\BaseReflector;
use phpDocumentor\Reflection\DocBlock;
use phpDocumentor\Reflection\DocBlock\Context;
use PHPParser_Node_Stmt_Class;
use PHPParser_Node_Stmt_Property;
use PHPParser_Node_Stmt_PropertyProperty;
class PropertyReflector extends BaseReflector
{
/** @var PHPParser_Node_Stmt_Property */
protected $property;
/** @var PHPParser_Node_Stmt_PropertyProperty */
protected $node;
public function __construct(
PHPParser_Node_Stmt_Property $property,
Context $context,
PHPParser_Node_Stmt_PropertyProperty $node
) {
parent::__construct($node, $context);
$this->property = $property;
}
public function getName()
{
return '$'.parent::getName();
}
/**
* Returns the default value or null if none found.
*
* Please note that if the default value is null that this method returns
* string 'null'.
*
* @return null|string
*/
public function getDefault()
{
$result = null;
if ($this->node->default) {
$result = $this->getRepresentationOfValue($this->node->default);
}
return $result;
}
/**
* Returns the visibility for this item.
*
* The returned value should match either of the following:
*
* * public
* * protected
* * private
*
* If a method has no visibility set in the class definition this method
* will return 'public'.
*
* @return string
*/
public function getVisibility()
{
if ($this->property->type & PHPParser_Node_Stmt_Class::MODIFIER_PROTECTED) {
return 'protected';
}
if ($this->property->type & PHPParser_Node_Stmt_Class::MODIFIER_PRIVATE) {
return 'private';
}
return 'public';
}
/**
* Returns whether this property is static.
*
* @return bool
*/
public function isStatic()
{
return (bool) ($this->property->type & PHPParser_Node_Stmt_Class::MODIFIER_STATIC);
}
/**
* Returns the parsed DocBlock.
*
* @return DocBlock|null
*/
public function getDocBlock()
{
return $this->extractDocBlock($this->property);
}
}
Reflection-1.0.7/src/phpDocumentor/Reflection/ConstantReflector.php 0000664 0000000 0000000 00000003213 12431365310 0025466 0 ustar 00root root 0000000 0000000
* @copyright 2010-2012 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;
use phpDocumentor\Reflection\DocBlock\Context;
use PHPParser_Node_Const;
use PHPParser_Node_Stmt_Const;
/**
* Provides Static Reflection for file-level constants.
*
* @author Mike van Riel
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
class ConstantReflector extends BaseReflector
{
/** @var PHPParser_Node_Stmt_Const */
protected $constant;
/** @var PHPParser_Node_Const */
protected $node;
/**
* Registers the Constant Statement and Node with this reflector.
*
* @param PHPParser_Node_Stmt_Const $stmt
* @param PHPParser_Node_Const $node
*/
public function __construct(
PHPParser_Node_Stmt_Const $stmt,
Context $context,
PHPParser_Node_Const $node
) {
parent::__construct($node, $context);
$this->constant = $stmt;
}
/**
* Returns the value contained in this Constant.
*
* @return string
*/
public function getValue()
{
return $this->getRepresentationOfValue($this->node->value);
}
/**
* Returns the parsed DocBlock.
*
* @return DocBlock|null
*/
public function getDocBlock()
{
return $this->extractDocBlock($this->constant);
}
}
Reflection-1.0.7/src/phpDocumentor/Reflection/Event/ 0000775 0000000 0000000 00000000000 12431365310 0022400 5 ustar 00root root 0000000 0000000 Reflection-1.0.7/src/phpDocumentor/Reflection/Event/ExportDocBlockTagEvent.php 0000664 0000000 0000000 00000001647 12431365310 0027441 0 ustar 00root root 0000000 0000000 xml;
}
/**
* @return Tag|null
*/
public function getObject()
{
return $this->object;
}
/**
* @param Tag $object
*
* @return ExportDocBlockTagEvent
*/
public function setObject(Tag $object = null)
{
$this->object = $object;
return $this;
}
/**
* @param DOMNode $xml
*
* @return ExportDocBlockTagEvent
*/
public function setXml(DOMNode $xml = null)
{
$this->xml = $xml;
return $this;
}
}
Reflection-1.0.7/src/phpDocumentor/Reflection/Event/PostDocBlockExtractionEvent.php 0000664 0000000 0000000 00000001102 12431365310 0030474 0 ustar 00root root 0000000 0000000 docblock = $docblock;
return $this;
}
/**
* @return DocBlock|null
*/
public function getDocblock()
{
return $this->docblock;
}
}
Reflection-1.0.7/src/phpDocumentor/Reflection/Exception.php 0000664 0000000 0000000 00000001122 12431365310 0023762 0 ustar 00root root 0000000 0000000
* @copyright 2010-2012 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;
/**
* An exception specifically originating from the Reflection component.
*
* @author Mike van Riel
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
class Exception extends \Exception
{
}
Reflection-1.0.7/src/phpDocumentor/Reflection/Exception/ 0000775 0000000 0000000 00000000000 12431365310 0023255 5 ustar 00root root 0000000 0000000 Reflection-1.0.7/src/phpDocumentor/Reflection/Exception/UnparsableFile.php 0000664 0000000 0000000 00000001312 12431365310 0026657 0 ustar 00root root 0000000 0000000
* @copyright 2010-2012 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\Exception;
/**
* Exception representing any situation where the file is not parsable.
*
* @author Mike van Riel
* @copyright 2010-2012 Mike van Riel / Naenius (http://www.naenius.com)
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
class UnparsableFile extends \phpDocumentor\Reflection\Exception
{
}
Reflection-1.0.7/src/phpDocumentor/Reflection/Exception/UnreadableFile.php 0000664 0000000 0000000 00000001363 12431365310 0026633 0 ustar 00root root 0000000 0000000
* @copyright 2010-2012 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\Exception;
/**
* Exception representing any error in the Reflection library due to a file not
* being readable or accessible.
*
* @author Mike van Riel
* @copyright 2010-2012 Mike van Riel / Naenius (http://www.naenius.com)
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
class UnreadableFile extends \phpDocumentor\Reflection\Exception
{
}
Reflection-1.0.7/src/phpDocumentor/Reflection/FileReflector.php 0000664 0000000 0000000 00000042423 12431365310 0024562 0 ustar 00root root 0000000 0000000
* @copyright 2010-2012 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\Event\Dispatcher;
use phpDocumentor\Parser\Event\LogEvent;
use phpDocumentor\Reflection\DocBlock;
use phpDocumentor\Reflection\DocBlock\Context;
use phpDocumentor\Reflection\DocBlock\Location;
use phpDocumentor\Reflection\Event\PostDocBlockExtractionEvent;
use phpDocumentor\Reflection\Exception;
use Psr\Log\LogLevel;
use PHPParser_Comment_Doc;
use PHPParser_Node;
use PHPParser_Node_Const;
use PHPParser_Node_Expr_FuncCall;
use PHPParser_Node_Expr_Include;
use PHPParser_Node_Name;
use PHPParser_Node_Stmt_Class;
use PHPParser_Node_Stmt_ClassConst;
use PHPParser_Node_Stmt_ClassMethod;
use PHPParser_Node_Stmt_Const;
use PHPParser_Node_Stmt_Function;
use PHPParser_Node_Stmt_InlineHTML;
use PHPParser_Node_Stmt_Interface;
use PHPParser_Node_Stmt_Property;
use PHPParser_Node_Stmt_PropertyProperty;
use PHPParser_Node_Stmt_Trait;
use PHPParser_Node_Stmt_UseUse;
use PHPParser_NodeVisitor;
/**
* Reflection class for a full file.
*
* @author Mike van Riel
* @copyright 2010-2012 Mike van Riel / Naenius (http://www.naenius.com)
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
class FileReflector extends ReflectionAbstract implements PHPParser_NodeVisitor
{
/** @var string An MD5 hashed representation of the contents of this file */
protected $hash;
/** @var string The contents of this file. */
protected $contents = '';
/** @var IncludeReflector[] */
protected $includes = array();
/** @var ConstantReflector[] */
protected $constants = array();
/** @var ClassReflector[] */
protected $classes = array();
/** @var TraitReflector[] */
protected $traits = array();
/** @var InterfaceReflector[] */
protected $interfaces = array();
/** @var FunctionReflector[] */
protected $functions = array();
/** @var string The name of the file associated with this reflection object. */
protected $filename = '';
/** @var DocBlock */
protected $doc_block;
/** @var string The package name that should be used if none is present in the file */
protected $default_package_name = 'Default';
/** @var string[] A list of markers contained in this file. */
protected $markers = array();
/** @var string[] A list of errors during processing */
protected $parse_markers = array();
/** @var string[] A list of all marker types to search for in this file. */
protected $marker_terms = array('TODO', 'FIXME');
/** @var Context */
protected $context;
/**
* Opens the file and retrieves its contents.
*
* During construction the given file is checked whether it is readable and
* if the $validate argument is true a PHP Lint action is executed to
* check whether the there are no parse errors.
*
* By default the Lint check is disabled because of the performance hit
* introduced by this action.
*
* If the validation checks out, the file's contents are read, converted to
* UTF-8 and the object is created from those contents.
*
* @param string $file Name of the file.
* @param boolean $validate Whether to check the file using PHP Lint.
* @param string $encoding The encoding of the file.
*
* @throws Exception\UnreadableFile If the filename is incorrect or
* the file cannot be opened
* @throws Exception\UnparsableFile If the file fails PHP lint checking
* (this can only happen when $validate is set to true)
*/
public function __construct($file, $validate = false, $encoding = 'utf-8')
{
if (!is_string($file) || (!is_readable($file))) {
throw new Exception\UnreadableFile(
'The given file should be a string, should exist on the filesystem and should be readable'
);
}
if ($validate) {
exec('php -l ' . escapeshellarg($file), $output, $result);
if ($result != 0) {
throw new Exception\UnparsableFile(
'The given file could not be interpreted as it contains errors: '
. implode(PHP_EOL, $output)
);
}
}
$this->filename = $file;
$this->contents = file_get_contents($file);
$this->context = new Context();
if (strtolower($encoding) !== 'utf-8' && extension_loaded('iconv')) {
$this->contents = iconv(
strtolower($encoding),
'utf-8//IGNORE//TRANSLIT',
$this->contents
);
}
// filemtime($file) is sometimes between 0.00001 and 0.00005 seconds
// faster but md5 is more accurate. It can also result in false
// positives or false negatives after copying or checking out a codebase.
$this->hash = md5($this->contents);
}
public function process()
{
// with big fluent interfaces it can happen that PHP-Parser's Traverser
// exceeds the 100 recursions limit; we set it to 10000 to be sure.
ini_set('xdebug.max_nesting_level', 10000);
$traverser = new Traverser();
$traverser->addVisitor($this);
$traverser->traverse($this->contents);
$this->scanForMarkers();
}
/**
* @return ClassReflector[]
*/
public function getClasses()
{
return $this->classes;
}
/**
* @return TraitReflector[]
*/
public function getTraits()
{
return $this->traits;
}
/**
* @return ConstantReflector[]
*/
public function getConstants()
{
return $this->constants;
}
/**
* @return FunctionReflector[]
*/
public function getFunctions()
{
return $this->functions;
}
/**
* @return IncludeReflector[]
*/
public function getIncludes()
{
return $this->includes;
}
/**
* @return InterfaceReflector[]
*/
public function getInterfaces()
{
return $this->interfaces;
}
public function beforeTraverse(array $nodes)
{
$node = null;
$key = 0;
foreach ($nodes as $k => $n) {
if (!$n instanceof PHPParser_Node_Stmt_InlineHTML) {
$node = $n;
$key = $k;
break;
}
}
if ($node) {
$comments = (array) $node->getAttribute('comments');
// remove non-DocBlock comments
$comments = array_values(
array_filter(
$comments,
function ($comment) {
return $comment instanceof PHPParser_Comment_Doc;
}
)
);
if (!empty($comments)) {
try {
$docblock = new DocBlock(
(string) $comments[0],
null,
new Location($comments[0]->getLine())
);
// the first DocBlock in a file documents the file if
// * it precedes another DocBlock or
// * it contains a @package tag and doesn't precede a class
// declaration or
// * it precedes a non-documentable element (thus no include,
// require, class, function, define, const)
if (count($comments) > 1
|| (!$node instanceof PHPParser_Node_Stmt_Class
&& !$node instanceof PHPParser_Node_Stmt_Interface
&& $docblock->hasTag('package'))
|| !$this->isNodeDocumentable($node)
) {
$this->doc_block = $docblock;
// remove the file level DocBlock from the node's comments
array_shift($comments);
}
} catch (\Exception $e) {
$this->log($e->getMessage(), LogLevel::CRITICAL);
}
}
// always update the comments attribute so that standard comments
// do not stop DocBlock from being attached to an element
$node->setAttribute('comments', $comments);
$nodes[$key] = $node;
}
if (class_exists('phpDocumentor\Event\Dispatcher')) {
Dispatcher::getInstance()->dispatch(
'reflection.docblock-extraction.post',
PostDocBlockExtractionEvent
::createInstance($this)->setDocblock($this->doc_block)
);
}
return $nodes;
}
/**
* Checks whether the given node is recogized by phpDocumentor as a
* documentable element.
*
* The following elements are recognized:
*
* - Trait
* - Class
* - Interface
* - Class constant
* - Class method
* - Property
* - Include/Require
* - Constant, both const and define
* - Function
*
* @param PHPParser_Node $node
*
* @return bool
*/
protected function isNodeDocumentable(PHPParser_Node $node)
{
return ($node instanceof PHPParser_Node_Stmt_Class)
|| ($node instanceof PHPParser_Node_Stmt_Interface)
|| ($node instanceof PHPParser_Node_Stmt_ClassConst)
|| ($node instanceof PHPParser_Node_Stmt_ClassMethod)
|| ($node instanceof PHPParser_Node_Stmt_Const)
|| ($node instanceof PHPParser_Node_Stmt_Function)
|| ($node instanceof PHPParser_Node_Stmt_Property)
|| ($node instanceof PHPParser_Node_Stmt_PropertyProperty)
|| ($node instanceof PHPParser_Node_Stmt_Trait)
|| ($node instanceof PHPParser_Node_Expr_Include)
|| ($node instanceof PHPParser_Node_Expr_FuncCall
&& ($node->name instanceof PHPParser_Node_Name)
&& $node->name == 'define');
}
public function enterNode(PHPParser_Node $node)
{
}
public function getName()
{
return $this->filename;
}
public function getFilename()
{
return $this->filename;
}
public function getHash()
{
return $this->hash;
}
public function getDocBlock()
{
return $this->doc_block;
}
public function getLineNumber()
{
return 0;
}
public function getDefaultPackageName()
{
return $this->default_package_name;
}
/**
* Adds a marker to scan the contents of this file for.
*
* @param string $name The Marker term, e.g. FIXME or TODO.
*
* @return void
*/
public function addMarker($name)
{
$this->marker_terms[] = $name;
}
/**
* Sets a list of markers to search for.
*
* @param string[] $markers A list of marker terms to scan for.
*
* @see phpDocumentor\Reflection\FileReflector::addMarker()
*
* @return void
*/
public function setMarkers(array $markers)
{
$this->marker_terms = array();
foreach ($markers as $marker) {
$this->addMarker($marker);
}
}
public function getMarkers()
{
return $this->markers;
}
/**
* Adds a parse error to the system
*
* @param LogEvent $data Contains the type,
* message, line and code element.
*
* @return void
*/
public function addParserMarker($data)
{
$this->parse_markers[] = array(
$data->getType(),
$data->getMessage(),
$data->getLine(),
$data->getCode()
);
}
/**
* Scans the file for markers and records them in the markers property.
*
* @see getMarkers()
*
* @todo this method may incur a performance penalty while the AST also
* contains the comments. This method should be replaced by a piece of
* code that interprets the comments in the AST.
* This has not been done since that may be an extensive refactoring (each
* PHPParser_Node* contains a 'comments' attribute and must thus recursively
* be discovered)
*
* @return void
*/
public function scanForMarkers()
{
// find all markers, get the entire file and check for marker terms.
$marker_data = array();
foreach (explode("\n", $this->contents) as $line_number => $line) {
preg_match_all(
'~//[\s]*(' . implode('|', $this->marker_terms) . ')\:?[\s]*(.*)~',
$line,
$matches,
PREG_SET_ORDER
);
foreach ($matches as &$match) {
$match[3] = $line_number + 1;
}
$marker_data = array_merge($marker_data, $matches);
}
// store marker results and remove first entry (entire match),
// this results in an array with 2 entries:
// marker name and content
$this->markers = $marker_data;
foreach ($this->markers as &$marker) {
array_shift($marker);
}
}
public function getParseErrors()
{
return $this->parse_markers;
}
public function getNamespace()
{
return $this->context->getNamespace();
}
public function getNamespaceAliases()
{
return $this->context->getNamespaceAliases();
}
public function getContents()
{
return $this->contents;
}
public function setDefaultPackageName($default_package_name)
{
$this->default_package_name = $default_package_name;
}
public function setFilename($filename)
{
$this->filename = $filename;
}
public function leaveNode(PHPParser_Node $node)
{
$prettyPrinter = new PrettyPrinter;
switch (get_class($node)) {
case 'PHPParser_Node_Stmt_Use':
/** @var PHPParser_Node_Stmt_UseUse $use */
foreach ($node->uses as $use) {
$this->context->setNamespaceAlias(
$use->alias,
implode('\\', $use->name->parts)
);
}
break;
case 'PHPParser_Node_Stmt_Namespace':
$this->context->setNamespace(
isset($node->name) && ($node->name) ? implode('\\', $node->name->parts) : ''
);
break;
case 'PHPParser_Node_Stmt_Class':
$class = new ClassReflector($node, $this->context);
$class->parseSubElements();
$this->classes[] = $class;
break;
case 'PHPParser_Node_Stmt_Trait':
$trait = new TraitReflector($node, $this->context);
$trait->parseSubElements();
$this->traits[] = $trait;
break;
case 'PHPParser_Node_Stmt_Interface':
$interface = new InterfaceReflector($node, $this->context);
$interface->parseSubElements();
$this->interfaces[] = $interface;
break;
case 'PHPParser_Node_Stmt_Function':
$function = new FunctionReflector($node, $this->context);
$this->functions[] = $function;
break;
case 'PHPParser_Node_Stmt_Const':
foreach ($node->consts as $constant) {
$reflector = new ConstantReflector(
$node,
$this->context,
$constant
);
$this->constants[] = $reflector;
}
break;
case 'PHPParser_Node_Expr_FuncCall':
if (($node->name instanceof PHPParser_Node_Name)
&& ($node->name == 'define')
&& isset($node->args[0])
&& isset($node->args[1])
) {
// transform the first argument of the define function call into a constant name
$name = str_replace(
array('\\\\', '"', "'"),
array('\\', '', ''),
trim($prettyPrinter->prettyPrintExpr($node->args[0]->value), '\'')
);
$nameParts = explode('\\', $name);
$shortName = end($nameParts);
$constant = new PHPParser_Node_Const($shortName, $node->args[1]->value, $node->getAttributes());
$constant->namespacedName = new PHPParser_Node_Name($name);
$constant_statement = new \PHPParser_Node_Stmt_Const(array($constant));
$constant_statement->setAttribute('comments', array($node->getDocComment()));
$this->constants[] = new ConstantReflector($constant_statement, $this->context, $constant);
}
break;
case 'PHPParser_Node_Expr_Include':
$include = new IncludeReflector($node, $this->context);
$this->includes[] = $include;
break;
}
}
public function afterTraverse(array $nodes)
{
}
}
Reflection-1.0.7/src/phpDocumentor/Reflection/FunctionReflector.php 0000664 0000000 0000000 00000004030 12431365310 0025460 0 ustar 00root root 0000000 0000000
* @copyright 2010-2012 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\BaseReflector;
use phpDocumentor\Reflection\DocBlock\Context;
use PHPParser_Node_Param;
use PHPParser_Node_Stmt;
use PHPParser_Node_Stmt_Function;
/**
* Provides Static Reflection for functions.
*
* @author Mike van Riel
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
class FunctionReflector extends BaseReflector
{
/** @var PHPParser_Node_Stmt_Function */
protected $node;
/** @var FunctionReflector\ArgumentReflector[] */
protected $arguments = array();
/**
* Initializes the reflector using the function statement object of
* PHP-Parser.
*
* @param PHPParser_Node_Stmt $node Function object coming from PHP-Parser.
* @param Context $context The context in which the node occurs.
*/
public function __construct(PHPParser_Node_Stmt $node, Context $context)
{
parent::__construct($node, $context);
/** @var PHPParser_Node_Param $param */
foreach ($node->params as $param) {
$reflector = new FunctionReflector\ArgumentReflector(
$param,
$context
);
$this->arguments[$reflector->getName()] = $reflector;
}
}
/**
* Checks whether the function returns a value by reference.
*
* @return bool TRUE if the return value is by reference, FALSE otherwise.
*/
public function isByRef()
{
return $this->node->byRef;
}
/**
* Returns a list of Argument objects.
*
* @return FunctionReflector\ArgumentReflector[]
*/
public function getArguments()
{
return $this->arguments;
}
}
Reflection-1.0.7/src/phpDocumentor/Reflection/FunctionReflector/ 0000775 0000000 0000000 00000000000 12431365310 0024752 5 ustar 00root root 0000000 0000000 Reflection-1.0.7/src/phpDocumentor/Reflection/FunctionReflector/ArgumentReflector.php 0000664 0000000 0000000 00000003073 12431365310 0031116 0 ustar 00root root 0000000 0000000
* @copyright 2010-2012 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\FunctionReflector;
use phpDocumentor\Reflection\BaseReflector;
class ArgumentReflector extends BaseReflector
{
/** @var \PHPParser_Node_Param */
protected $node;
/**
* Checks whether the argument is passed by reference.
*
* @return bool TRUE if the argument is by reference, FALSE otherwise.
*/
public function isByRef()
{
return $this->node->byRef;
}
/**
* Returns the default value or null is none is set.
*
* @return string|null
*/
public function getDefault()
{
$result = null;
if ($this->node->default) {
$result = $this->getRepresentationOfValue($this->node->default);
}
return $result;
}
/**
* Returns the typehint, or null if none is set.
*
* @return string|null
*/
public function getType()
{
$type = (string) $this->node->type;
// in case of the callable of array keyword; do not prefix with a \
if ($type == 'callable' || $type == 'array'
|| $type == 'self' || $type == '$this'
) {
return $type;
}
return $type ? '\\'.$type : '';
}
public function getName()
{
return '$'.parent::getName();
}
}
Reflection-1.0.7/src/phpDocumentor/Reflection/IncludeReflector.php 0000664 0000000 0000000 00000002713 12431365310 0025264 0 ustar 00root root 0000000 0000000
* @copyright 2010-2012 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 Exception;
use PHPParser_Node_Expr_Include;
class IncludeReflector extends BaseReflector
{
/** @var PHPParser_Node_Expr_Include */
protected $node;
/**
* Returns the type of this include.
*
* Valid types are:
* - Include
* - Include Once
* - Require
* - Require Once
*
* @throws Exception if the include is of an unknown type
*
* @return string
*/
public function getType()
{
switch ($this->node->type) {
case PHPParser_Node_Expr_Include::TYPE_INCLUDE:
return 'Include';
case PHPParser_Node_Expr_Include::TYPE_INCLUDE_ONCE:
return 'Include Once';
case PHPParser_Node_Expr_Include::TYPE_REQUIRE:
return 'Require';
case PHPParser_Node_Expr_Include::TYPE_REQUIRE_ONCE:
return 'Require Once';
default:
throw new Exception(
'Unknown include type detected: '.$this->node->type
);
}
}
public function getShortName()
{
return (string) $this->node->expr->value;
}
}
Reflection-1.0.7/src/phpDocumentor/Reflection/InterfaceReflector.php 0000664 0000000 0000000 00000006137 12431365310 0025605 0 ustar 00root root 0000000 0000000
* @copyright 2010-2012 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 PHPParser_Node_Name;
use PHPParser_Node_Stmt_Class;
use PHPParser_Node_Stmt_Interface;
class InterfaceReflector extends BaseReflector
{
/** @var PHPParser_Node_Stmt_Interface|PHPParser_Node_Stmt_Class */
protected $node;
/**
* @var ClassReflector\ConstantReflector[]
*/
protected $constants = array();
/**
* @var ClassReflector\PropertyReflector[]
*/
protected $properties = array();
/**
* @var ClassReflector\MethodReflector[]
*/
protected $methods = array();
public function parseSubElements()
{
foreach ($this->node->stmts as $stmt) {
switch (get_class($stmt)) {
case 'PHPParser_Node_Stmt_Property':
foreach ($stmt->props as $property) {
$this->properties[] = new ClassReflector\PropertyReflector(
$stmt,
$this->context,
$property
);
}
break;
case 'PHPParser_Node_Stmt_ClassMethod':
$this->methods[strtolower($stmt->name)] = new ClassReflector\MethodReflector(
$stmt,
$this->context
);
break;
case 'PHPParser_Node_Stmt_ClassConst':
foreach ($stmt->consts as $constant) {
$this->constants[] = new ClassReflector\ConstantReflector(
$stmt,
$this->context,
$constant
);
}
break;
}
}
}
public function getParentInterfaces()
{
$names = array();
if ($this->node instanceof PHPParser_Node_Stmt_Interface
&& $this->node->extends
) {
/** @var PHPParser_Node_Name */
foreach ($this->node->extends as $node) {
$names[] = '\\'.(string) $node;
}
}
return $names;
}
/**
* @return ClassReflector\ConstantReflector[]
*/
public function getConstants()
{
return $this->constants;
}
/**
* @return ClassReflector\PropertyReflector[]
*/
public function getProperties()
{
return $this->properties;
}
/**
* @return ClassReflector\MethodReflector[]
*/
public function getMethods()
{
return $this->methods;
}
/**
* @param string $name the method name
* @return ClassReflector\MethodReflector|null
*/
public function getMethod($name)
{
$name = strtolower($name);
return isset($this->methods[$name]) ? $this->methods[$name] : null;
}
}
Reflection-1.0.7/src/phpDocumentor/Reflection/Lexer.php 0000664 0000000 0000000 00000004122 12431365310 0023106 0 ustar 00root root 0000000 0000000
* @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 PHPParser_Lexer;
use PHPParser_Parser;
/**
* Custom lexer for phpDocumentor.
*
* phpDocumentor has a custom Lexer for PHP-Parser because it needs
* unmodified value for Scalar variables instead of an interpreted version.
*
* If the interpreted version was to be used then the XML interpretation would
* fail because of special characters.
*
* @author Mike van Riel
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
class Lexer extends PHPParser_Lexer
{
/**
* Retrieves the next token and determines the associated attributes and
* returns the token id.
*
* @param string $value
* @param string[] $startAttributes
* @param string[] $endAttributes
*
* @return int
*/
public function getNextToken(
&$value = null,
&$startAttributes = null,
&$endAttributes = null
) {
$tokenId = parent::getNextToken($value, $startAttributes, $endAttributes);
if ($this->isTokenScalar($tokenId)) {
// store original value because the value itself will be interpreted
// by PHP_Parser and we want the unformatted value
$endAttributes['originalValue'] = $value;
}
return $tokenId;
}
/**
* Returns whether the given token id is a scalar that will be interpreted
* by PHP-Parser.
*
* @param int $tokenId The id to check, must match a \PHPParser_Parser::T_*
* constant.
*
* @return bool
*/
protected function isTokenScalar($tokenId)
{
return $tokenId == PHPParser_Parser::T_CONSTANT_ENCAPSED_STRING
|| $tokenId == PHPParser_Parser::T_LNUMBER
|| $tokenId == PHPParser_Parser::T_DNUMBER;
}
}
Reflection-1.0.7/src/phpDocumentor/Reflection/PrettyPrinter.php 0000664 0000000 0000000 00000003462 12431365310 0024670 0 ustar 00root root 0000000 0000000
* @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 PHPParser_Node_Scalar_String;
use PHPParser_PrettyPrinter_Zend;
/**
* Custom PrettyPrinter for phpDocumentor.
*
* phpDocumentor has a custom PrettyPrinter for PHP-Parser because it needs the
* unmodified value for Scalar variables instead of an interpreted version.
*
* If the interpreted version was to be used then the XML interpretation would
* fail because of special characters.
*
* @author Mike van Riel
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
class PrettyPrinter extends PHPParser_PrettyPrinter_Zend
{
/**
* Converts the string into it's original representation without converting
* the special character combinations.
*
* This method is overridden from the original Zend Pretty Printer because
* the original returns the strings as interpreted by PHP-Parser.
* Since we do not want such conversions we take the original that is
* injected by our own custom Lexer.
*
* @param PHPParser_Node_Scalar_String $node The node to return a string
* representation of.
*
* @see Lexer where the originalValue is injected.
*
* @return string
*/
public function pScalar_String(PHPParser_Node_Scalar_String $node)
{
if (method_exists($this, 'pSafe')) {
return $this->pSafe($node->getAttribute('originalValue'));
}
return $this->pNoIndent($node->getAttribute('originalValue'));
}
}
Reflection-1.0.7/src/phpDocumentor/Reflection/ReflectionAbstract.php 0000664 0000000 0000000 00000003603 12431365310 0025610 0 ustar 00root root 0000000 0000000
* @copyright 2012 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\Event\DebugEvent;
use phpDocumentor\Event\Dispatcher;
use phpDocumentor\Event\LogEvent;
/**
* Provides basic event logging and dispatching for every reflection class.
*
* @author Mike van Riel
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
abstract class ReflectionAbstract
{
/**
* The context (namespace, aliases) for the reflection.
*
* @var \phpDocumentor\Reflection\DocBlock\Context
*/
protected $context = null;
/**
* Dispatches a logging request.
*
* @param string $message The message to log.
* @param int $priority The logging priority, the lower,
* the more important. Ranges from 1 to 7
*
* @return void
*/
public function log($message, $priority = 6)
{
if (class_exists('phpDocumentor\Event\Dispatcher')) {
Dispatcher::getInstance()->dispatch(
'system.log',
LogEvent::createInstance($this)
->setMessage($message)->setPriority($priority)
);
}
}
/**
* Dispatches a logging request to log a debug message.
*
* @param string $message The message to log.
*
* @return void
*/
public function debug($message)
{
if (class_exists('phpDocumentor\Event\Dispatcher')) {
Dispatcher::getInstance()->dispatch(
'system.debug',
DebugEvent::createInstance($this)
->setMessage($message)
);
}
}
}
Reflection-1.0.7/src/phpDocumentor/Reflection/TraitReflector.php 0000664 0000000 0000000 00000000663 12431365310 0024766 0 ustar 00root root 0000000 0000000
* @copyright 2010-2012 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 TraitReflector extends ClassReflector
{
/** @var \PHPParser_Node_Stmt_Trait */
protected $node;
}
Reflection-1.0.7/src/phpDocumentor/Reflection/Traverser.php 0000664 0000000 0000000 00000004636 12431365310 0024016 0 ustar 00root root 0000000 0000000
* @copyright 2010-2012 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 PHPParser_Error;
use PHPParser_NodeTraverser;
use PHPParser_NodeVisitor;
use PHPParser_NodeVisitor_NameResolver;
use PHPParser_NodeVisitorAbstract;
use PHPParser_Parser;
/**
* The source code traverser that scans the given source code and transforms
* it into tokens.
*
* @author Mike van Riel
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
class Traverser
{
/**
* List of visitors to apply upon traversing.
*
* @see traverse()
*
* @var PHPParser_NodeVisitorAbstract[]
*/
public $visitors = array();
/**
* Traverses the given contents and builds an AST.
*
* @param string $contents The source code of the file that is to be scanned
*
* @return void
*/
public function traverse($contents)
{
try {
$this->createTraverser()->traverse(
$this->createParser()->parse($contents)
);
} catch (PHPParser_Error $e) {
echo 'Parse Error: ', $e->getMessage();
}
}
/**
* Adds a visitor object to the traversal process.
*
* With visitors it is possible to extend the traversal process and
* modify the found tokens.
*
* @param PHPParser_NodeVisitor $visitor
*
* @return void
*/
public function addVisitor(PHPParser_NodeVisitor $visitor)
{
$this->visitors[] = $visitor;
}
/**
* Creates a parser object using our own Lexer.
*
* @return PHPParser_Parser
*/
protected function createParser()
{
return new PHPParser_Parser(new Lexer());
}
/**
* Creates a new traverser object and adds visitors.
*
* @return PHPParser_NodeTraverser
*/
protected function createTraverser()
{
$node_traverser = new PHPParser_NodeTraverser();
$node_traverser->addVisitor(new PHPParser_NodeVisitor_NameResolver());
foreach ($this->visitors as $visitor) {
$node_traverser->addVisitor($visitor);
}
return $node_traverser;
}
}
Reflection-1.0.7/tests/ 0000775 0000000 0000000 00000000000 12431365310 0014751 5 ustar 00root root 0000000 0000000 Reflection-1.0.7/tests/mocks/ 0000775 0000000 0000000 00000000000 12431365310 0016065 5 ustar 00root root 0000000 0000000 Reflection-1.0.7/tests/mocks/phpDocumentor/ 0000775 0000000 0000000 00000000000 12431365310 0020714 5 ustar 00root root 0000000 0000000 Reflection-1.0.7/tests/mocks/phpDocumentor/Reflection/ 0000775 0000000 0000000 00000000000 12431365310 0023006 5 ustar 00root root 0000000 0000000 Reflection-1.0.7/tests/mocks/phpDocumentor/Reflection/BaseReflectorMock.php 0000664 0000000 0000000 00000002326 12431365310 0027054 0 ustar 00root root 0000000 0000000
* @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 PHPParser_Node_Expr;
/**
* Class for testing base reflector.
*
* Extends the baseReflector so properties and abstract methods can be mocked,
* and therefore tested.
*
* @author Erik Baars
* @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 BaseReflectorMock extends BaseReflector
{
/**
* Overload method so we can test the protected method
*
* @param PHPParser_Node_Expr $value
*
* @return string
*/
public function getRepresentationOfValueMock(
PHPParser_Node_Expr $value = null
) {
return parent::getRepresentationOfValue($value);
}
/**
* @param $val
*
* @return void
*/
public function setPrettyPrinter($val)
{
self::$prettyPrinter = $val;
}
}
Reflection-1.0.7/tests/mocks/phpDocumentor/Reflection/ClassReflectorMock.php 0000664 0000000 0000000 00000001475 12431365310 0027253 0 ustar 00root root 0000000 0000000
* @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;
/**
* Class for testing ClassReflector.
*
* Extends the ClassReflector so properties and abstract methods can be mocked,
* and therefore tested.
*
* @author Erik Baars
* @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 ClassReflectorMock extends ClassReflector
{
public function setTraits(array $val)
{
$this->traits = $val;
}
}
Reflection-1.0.7/tests/mocks/phpDocumentor/Reflection/NodeExprMock.php 0000664 0000000 0000000 00000001422 12431365310 0026054 0 ustar 00root root 0000000 0000000
* @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 PHPParser_Node_Expr;
/**
* Class for testing PHPParser_Node_Expr.
*
* Extends the PHPParser_Node_Expr so properties and abstract methods can be mocked,
* and therefore tested.
*
* @author Vasil Rangelov
* @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 NodeExprMock extends PHPParser_Node_Expr
{
}
Reflection-1.0.7/tests/mocks/phpDocumentor/Reflection/NodeStmtMock.php 0000664 0000000 0000000 00000001675 12431365310 0026077 0 ustar 00root root 0000000 0000000
* @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 PHPParser_Node_Stmt;
/**
* Class for testing PHPParser_Node_Stmt.
*
* Extends the PHPParser_Node_Stmt so properties and abstract methods can be mocked,
* and therefore tested.
*
* @author Erik Baars
* @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 NodeStmtMock extends PHPParser_Node_Stmt
{
public $name = null;
public function setName($val)
{
$this->name = $val;
}
public function __toString()
{
return 'testNodeMock';
}
}
Reflection-1.0.7/tests/mocks/phpDocumentor/Reflection/NodeStmtMock2.php 0000664 0000000 0000000 00000001546 12431365310 0026156 0 ustar 00root root 0000000 0000000
* @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 PHPParser_Node_Stmt;
/**
* Class for testing PHPParser_Node_Stmt.
*
* Extends the PHPParser_Node_Stmt so properties and abstract methods can be mocked,
* and therefore tested.
*
* @author Erik Baars
* @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 NodeStmtMock2 extends PHPParser_Node_Stmt
{
public $type = null;
public $implements = array();
public $extends = null;
}
Reflection-1.0.7/tests/unit/ 0000775 0000000 0000000 00000000000 12431365310 0015730 5 ustar 00root root 0000000 0000000 Reflection-1.0.7/tests/unit/phpDocumentor/ 0000775 0000000 0000000 00000000000 12431365310 0020557 5 ustar 00root root 0000000 0000000 Reflection-1.0.7/tests/unit/phpDocumentor/Reflection/ 0000775 0000000 0000000 00000000000 12431365310 0022651 5 ustar 00root root 0000000 0000000 Reflection-1.0.7/tests/unit/phpDocumentor/Reflection/BaseReflectorTest.php 0000664 0000000 0000000 00000017500 12431365310 0026745 0 ustar 00root root 0000000 0000000
* @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\Context;
use PHPUnit_Framework_TestCase;
/**
* Class for testing base reflector.
*
* @author Erik Baars
* @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 BaseReflectorTest extends PHPUnit_Framework_TestCase
{
/**
* Tests the setNameSpace method
*
* @covers \phpDocumentor\Reflection\BaseReflector::setNameSpace
* @covers \phpDocumentor\Reflection\BaseReflector::getNameSpace
*
* @return void
*/
public function testSetNameSpace()
{
/** @var BaseReflector $base_reflector */
$base_reflector = new BaseReflectorMock(
$this->getMock('PHPParser_Node_Stmt'),
new Context()
);
$base_reflector->setNamespace('namespace_name');
$this->assertEquals('namespace_name', $base_reflector->getNameSpace());
}
/**
* Tests the setNameSpace method when an invalid argument is passed
*
* @covers \phpDocumentor\Reflection\BaseReflector::setNameSpace
*
* @expectedException \InvalidArgumentException
*
* @return void
*/
public function testSetNameSpaceInvalidArgument()
{
/** @var BaseReflector $base_reflector */
$base_reflector = new BaseReflectorMock(
$this->getMock('PHPParser_Node_Stmt'),
new Context()
);
$base_reflector->setNamespace(null);
}
/**
* Tests the getDocblock method
*
* @covers \phpDocumentor\Reflection\BaseReflector::getDocBlock
*
* @return void
*/
public function testGetDocBlock()
{
$this->markTestIncomplete();
}
/**
* Tests the getName method
*
* @covers \phpDocumentor\Reflection\BaseReflector::getName
*
* @return void
*/
public function testGetName()
{
$this->markTestIncomplete();
}
/**
* Tests the getShortName method
*
* @covers \phpDocumentor\Reflection\BaseReflector::getShortName
*
* @return void
*/
public function testGetShortName()
{
$node = new NodeStmtMock();
$base_reflector = new BaseReflectorMock(
$node,
new Context()
);
$this->assertEquals($node->__toString(), $base_reflector->getShortName());
$node->setName('test_name');
$this->assertEquals('test_name', $base_reflector->getShortName());
}
/**
* Tests the getNameSpaceAlias method
*
* @covers \phpDocumentor\Reflection\BaseReflector::getNamespaceAliases
* @covers \phpDocumentor\Reflection\BaseReflector::setNamespaceAliases
*
* @return void
*/
public function testGetNamespaceAliases()
{
$node = new NodeStmtMock();
$base_reflector = new BaseReflectorMock(
$node,
new Context()
);
$this->assertEquals(array(), $base_reflector->getNamespaceAliases());
$base_reflector->setNamespaceAliases(
array('test_namespace', 'test_namespace_2')
);
$this->assertCount(2, $base_reflector->getNamespaceAliases());
$this->assertEquals(
array('\test_namespace', '\test_namespace_2'),
$base_reflector->getNamespaceAliases()
);
}
/**
* Tests the getNameSpaceAlias method
*
* Tests the following scenarios:
* - no namespace aliases set yet
* - overwrite the current namespace alias
* - add another namespace alias without overwriting the already set alias
*
* @covers \phpDocumentor\Reflection\BaseReflector::getNamespaceAliases
* @covers \phpDocumentor\Reflection\BaseReflector::setNamespaceAlias
*
* @return void
*/
public function testsetNamespaceAlias()
{
$node = new NodeStmtMock();
$base_reflector = new BaseReflectorMock(
$node,
new Context()
);
$this->assertEquals(array(), $base_reflector->getNamespaceAliases());
$base_reflector->setNamespaceAlias('test_alias', 'test_namespace');
$namespace_aliases = $base_reflector->getNamespaceAliases();
$this->assertCount(1, $namespace_aliases);
$this->assertArrayHasKey('test_alias', $namespace_aliases);
$this->assertEquals('\test_namespace', $namespace_aliases['test_alias']);
$base_reflector->setNamespaceAlias('test_alias', 'test_namespace_2');
$namespace_aliases = $base_reflector->getNamespaceAliases();
$this->assertCount(1, $namespace_aliases);
$this->assertArrayHasKey('test_alias', $namespace_aliases);
$this->assertEquals('\test_namespace_2', $namespace_aliases['test_alias']);
$base_reflector->setNamespaceAlias('test_alias2', 'test_namespace');
$namespace_aliases = $base_reflector->getNamespaceAliases();
$this->assertCount(2, $namespace_aliases);
$this->assertArrayHasKey('test_alias', $namespace_aliases);
$this->assertArrayHasKey('test_alias2', $namespace_aliases);
$this->assertEquals('\test_namespace_2', $namespace_aliases['test_alias']);
$this->assertEquals('\test_namespace', $namespace_aliases['test_alias2']);
}
/**
* Tests the getLinenumber method
*
* @covers \phpDocumentor\Reflection\BaseReflector::getLinenumber
*
* @return void
*/
public function testGetLinenumber()
{
$node = new NodeStmtMock();
$base_reflector = new BaseReflectorMock(
$node,
new Context()
);
$this->assertEquals($node->getLine(), $base_reflector->getLinenumber());
$node->setLine(123);
$this->assertEquals(123, $base_reflector->getLinenumber());
}
/**
* Tests the setDefaultPackageName method
*
* @covers \phpDocumentor\Reflection\BaseReflector::setDefaultPackageName
* @covers \phpDocumentor\Reflection\BaseReflector::getDefaultPackageName
*
* @return void
*/
public function testSetDefaultPackageName()
{
$node = new NodeStmtMock();
$base_reflector = new BaseReflectorMock(
$node,
new Context()
);
$this->assertInternalType(
'string',
$base_reflector->getDefaultPackageName()
);
$this->assertEquals('', $base_reflector->getDefaultPackageName());
$base_reflector->setDefaultPackageName('test_name');
$this->assertEquals('test_name', $base_reflector->getDefaultPackageName());
}
/**
* Tests the setDefaultPackageName method
*
* @covers \phpDocumentor\Reflection\BaseReflector::getRepresentationOfValue
*
* @return void
*/
public function testGetRepresentationOfValue()
{
$node = new NodeStmtMock();
$base_reflector = new BaseReflectorMock(
$node,
new Context()
);
$this->assertEquals('', $base_reflector->getRepresentationOfValueMock(null));
$pretty_printer = $this->getMock(
'\phpDocumentor\Reflection\PrettyPrinter',
array('prettyPrintExpr')
);
$base_reflector->setPrettyPrinter($pretty_printer);
$pretty_printer
->expects($this->once())
->method('prettyPrintExpr')
->will($this->returnValue('test_output'));
$this->assertEquals(
'test_output',
$base_reflector->getRepresentationOfValueMock(new NodeExprMock())
);
}
}
Reflection-1.0.7/tests/unit/phpDocumentor/Reflection/ClassReflectorTest.php 0000664 0000000 0000000 00000011244 12431365310 0027137 0 ustar 00root root 0000000 0000000
* @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\Context;
use PHPParser_Node_Stmt_Class;
use PHPUnit_Framework_TestCase;
/**
* Class for testing ClassReflector.
*
* @author Erik Baars
* @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 ClassReflectorTest extends PHPUnit_Framework_TestCase
{
/**
* Tests the parseSubElements method
*
* @covers \phpDocumentor\Reflection\ClassReflector::parseSubElements
*
* @return void
*/
public function testParseSubElements()
{
$this->markTestIncomplete();
}
/**
* Tests the parseSubElements method
*
* @covers \phpDocumentor\Reflection\ClassReflector::isAbstract
*
* @return void
*/
public function testIsAbstract()
{
//$this->markTestSkipped();
$node = new NodeStmtMock2();
$class_reflector = new ClassReflector(
$node,
new Context()
);
$this->assertFalse($class_reflector->isAbstract());
$node->type = PHPParser_Node_Stmt_Class::MODIFIER_ABSTRACT;
$this->assertTrue($class_reflector->isAbstract());
}
/**
* Tests the parseSubElements method
*
* @covers \phpDocumentor\Reflection\ClassReflector::isFinal
*
* @return void
*/
public function testIsFinal()
{
$node = new NodeStmtMock2();
$class_reflector = new ClassReflector(
$node,
new Context()
);
$this->assertFalse($class_reflector->isFinal());
$node->type = PHPParser_Node_Stmt_Class::MODIFIER_FINAL;
$this->assertTrue($class_reflector->isFinal());
}
/**
* Tests the parseSubElements method
*
* @covers \phpDocumentor\Reflection\ClassReflector::getTraits
*
* @return void
*/
public function testGetTraits()
{
$node = new NodeStmtMock();
$class_reflector = new ClassReflectorMock(
$node,
new Context()
);
$traits = $class_reflector->getTraits();
$this->assertInternalType('array', $traits);
$this->assertEmpty($traits);
$class_reflector->setTraits(array('trait1', 'trait2'));
$traits = $class_reflector->getTraits();
$this->assertCount(2, $traits);
$this->assertEquals('trait1', reset($traits));
}
/**
* Tests the parseSubElements method
*
* @covers \phpDocumentor\Reflection\ClassReflector::getParentClass
*
* @return void
*/
public function testGetParentClass()
{
$node = new NodeStmtMock();
$class_reflector = new ClassReflectorMock(
$node,
new Context()
);
$this->assertEquals('', $class_reflector->getParentClass());
$node->extends = 'dummy';
$this->assertEquals('\dummy', $class_reflector->getParentClass());
}
/**
* Tests the parseSubElements method
*
* @covers \phpDocumentor\Reflection\ClassReflector::getInterfaces
*
* @return void
*/
public function testGetInterfaces()
{
$node = new NodeStmtMock();
$class_reflector = new ClassReflectorMock(
$node,
new Context()
);
$this->assertEquals(array(), $class_reflector->getInterfaces());
$node->implements = array('dummy');
$this->assertEquals(array('\dummy'), $class_reflector->getInterfaces());
}
/**
* Tests the getMethod method
*
* @covers \phpDocumentor\Reflection\ClassReflector::getMethod
*
* @return void
*/
public function testGetMethod()
{
$node = new NodeStmtMock();
$node->stmts = array(new \PHPParser_Node_Stmt_ClassMethod('someMethod'));
$class_reflector = new ClassReflectorMock(
$node,
new Context()
);
// Before parseSubElements
$this->assertNull($class_reflector->getMethod('someMethod'));
$class_reflector->parseSubElements();
// After parseSubElements
$this->assertInstanceOf(
'\phpDocumentor\Reflection\ClassReflector\MethodReflector',
$class_reflector->getMethod('someMethod')
);
$this->assertNull($class_reflector->getMethod('someOtherMethod'));
}
}
Reflection-1.0.7/tests/unit/phpDocumentor/Reflection/PrettyPrinterTest.php 0000664 0000000 0000000 00000002277 12431365310 0027065 0 ustar 00root root 0000000 0000000
* @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 PHPParser_Node_Scalar_String;
use PHPUnit_Framework_TestCase;
/**
* Class for testing the PrettyPrinter.
*
* @author Vasil Rangelov
* @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 PrettyPrinterTest extends PHPUnit_Framework_TestCase
{
/**
* @covers \phpDocumentor\Reflection\PrettyPrinter::pScalar_String
*
* @return void
*/
public function testScalarStringPrinting()
{
$object = new PrettyPrinter();
$this->assertEquals(
'Another value',
$object->pScalar_String(
new PHPParser_Node_Scalar_String(
'Value',
array('originalValue' => 'Another value')
)
)
);
}
}