http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/nesbot/carbon/tests/StringsTest.php ---------------------------------------------------------------------- diff --git a/vendor/nesbot/carbon/tests/StringsTest.php b/vendor/nesbot/carbon/tests/StringsTest.php deleted file mode 100644 index b3cc2fe..0000000 --- a/vendor/nesbot/carbon/tests/StringsTest.php +++ /dev/null @@ -1,157 +0,0 @@ -<?php - -/* - * This file is part of the Carbon package. - * - * (c) Brian Nesbitt <[email protected]> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -use Carbon\Carbon; - -class MyCarbon extends Carbon -{ -} - -class StringsTest extends TestFixture -{ - public function testToString() - { - $d = Carbon::now(); - $this->assertSame(Carbon::now()->toDateTimeString(), ''.$d); - } - public function testSetToStringFormat() - { - Carbon::setToStringFormat('jS \o\f F, Y g:i:s a'); - $d = Carbon::create(1975, 12, 25, 14, 15, 16); - $this->assertSame('25th of December, 1975 2:15:16 pm', ''.$d); - } - public function testResetToStringFormat() - { - $d = Carbon::now(); - Carbon::setToStringFormat('123'); - Carbon::resetToStringFormat(); - $this->assertSame($d->toDateTimeString(), ''.$d); - } - public function testExtendedClassToString() - { - $d = MyCarbon::now(); - $this->assertSame($d->toDateTimeString(), ''.$d); - } - - public function testToDateString() - { - $d = Carbon::create(1975, 12, 25, 14, 15, 16); - $this->assertSame('1975-12-25', $d->toDateString()); - } - public function testToFormattedDateString() - { - $d = Carbon::create(1975, 12, 25, 14, 15, 16); - $this->assertSame('Dec 25, 1975', $d->toFormattedDateString()); - } - public function testToLocalizedFormattedDateString() - { - /**************** - - Working out a Travis issue on how to set a different locale - other than EN to test this. - - - $cache = setlocale(LC_TIME, 0); - setlocale(LC_TIME, 'German'); - $d = Carbon::create(1975, 12, 25, 14, 15, 16); - $this->assertSame('Donnerstag 25 Dezember 1975', $d->formatLocalized('%A %d %B %Y')); - setlocale(LC_TIME, $cache); - - *****************/ - } - public function testToLocalizedFormattedTimezonedDateString() - { - $d = Carbon::create(1975, 12, 25, 14, 15, 16, 'Europe/London'); - $this->assertSame('Thursday 25 December 1975 14:15', $d->formatLocalized('%A %d %B %Y %H:%M')); - } - public function testToTimeString() - { - $d = Carbon::create(1975, 12, 25, 14, 15, 16); - $this->assertSame('14:15:16', $d->toTimeString()); - } - public function testToDateTimeString() - { - $d = Carbon::create(1975, 12, 25, 14, 15, 16); - $this->assertSame('1975-12-25 14:15:16', $d->toDateTimeString()); - } - public function testToDateTimeStringWithPaddedZeroes() - { - $d = Carbon::create(2000, 5, 2, 4, 3, 4); - $this->assertSame('2000-05-02 04:03:04', $d->toDateTimeString()); - } - public function testToDayDateTimeString() - { - $d = Carbon::create(1975, 12, 25, 14, 15, 16); - $this->assertSame('Thu, Dec 25, 1975 2:15 PM', $d->toDayDateTimeString()); - } - - public function testToAtomString() - { - $d = Carbon::create(1975, 12, 25, 14, 15, 16); - $this->assertSame('1975-12-25T14:15:16-05:00', $d->toAtomString()); - } - public function testToCOOKIEString() - { - $d = Carbon::create(1975, 12, 25, 14, 15, 16); - if (\DateTime::COOKIE === 'l, d-M-y H:i:s T') { - $cookieString = 'Thursday, 25-Dec-75 14:15:16 EST'; - } else { - $cookieString = 'Thursday, 25-Dec-1975 14:15:16 EST'; - } - - $this->assertSame($cookieString, $d->toCOOKIEString()); - } - public function testToIso8601String() - { - $d = Carbon::create(1975, 12, 25, 14, 15, 16); - $this->assertSame('1975-12-25T14:15:16-0500', $d->toIso8601String()); - } - public function testToRC822String() - { - $d = Carbon::create(1975, 12, 25, 14, 15, 16); - $this->assertSame('Thu, 25 Dec 75 14:15:16 -0500', $d->toRfc822String()); - } - public function testToRfc850String() - { - $d = Carbon::create(1975, 12, 25, 14, 15, 16); - $this->assertSame('Thursday, 25-Dec-75 14:15:16 EST', $d->toRfc850String()); - } - public function testToRfc1036String() - { - $d = Carbon::create(1975, 12, 25, 14, 15, 16); - $this->assertSame('Thu, 25 Dec 75 14:15:16 -0500', $d->toRfc1036String()); - } - public function testToRfc1123String() - { - $d = Carbon::create(1975, 12, 25, 14, 15, 16); - $this->assertSame('Thu, 25 Dec 1975 14:15:16 -0500', $d->toRfc1123String()); - } - public function testToRfc2822String() - { - $d = Carbon::create(1975, 12, 25, 14, 15, 16); - $this->assertSame('Thu, 25 Dec 1975 14:15:16 -0500', $d->toRfc2822String()); - } - public function testToRfc3339String() - { - $d = Carbon::create(1975, 12, 25, 14, 15, 16); - $this->assertSame('1975-12-25T14:15:16-05:00', $d->toRfc3339String()); - } - public function testToRssString() - { - $d = Carbon::create(1975, 12, 25, 14, 15, 16); - $this->assertSame('Thu, 25 Dec 1975 14:15:16 -0500', $d->toRssString()); - } - public function testToW3cString() - { - $d = Carbon::create(1975, 12, 25, 14, 15, 16); - $this->assertSame('1975-12-25T14:15:16-05:00', $d->toW3cString()); - } -}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/nesbot/carbon/tests/SubTest.php ---------------------------------------------------------------------- diff --git a/vendor/nesbot/carbon/tests/SubTest.php b/vendor/nesbot/carbon/tests/SubTest.php deleted file mode 100644 index ea4f3bd..0000000 --- a/vendor/nesbot/carbon/tests/SubTest.php +++ /dev/null @@ -1,175 +0,0 @@ -<?php - -/* - * This file is part of the Carbon package. - * - * (c) Brian Nesbitt <[email protected]> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -use Carbon\Carbon; - -class SubTest extends TestFixture -{ - public function testSubYearsPositive() - { - $this->assertSame(1974, Carbon::createFromDate(1975)->subYears(1)->year); - } - - public function testSubYearsZero() - { - $this->assertSame(1975, Carbon::createFromDate(1975)->subYears(0)->year); - } - - public function testSubYearsNegative() - { - $this->assertSame(1976, Carbon::createFromDate(1975)->subYears(-1)->year); - } - - public function testSubYear() - { - $this->assertSame(1974, Carbon::createFromDate(1975)->subYear()->year); - } - - public function testSubMonthsPositive() - { - $this->assertSame(12, Carbon::createFromDate(1975, 1, 1)->subMonths(1)->month); - } - - public function testSubMonthsZero() - { - $this->assertSame(1, Carbon::createFromDate(1975, 1, 1)->subMonths(0)->month); - } - - public function testSubMonthsNegative() - { - $this->assertSame(2, Carbon::createFromDate(1975, 1, 1)->subMonths(-1)->month); - } - - public function testSubMonth() - { - $this->assertSame(12, Carbon::createFromDate(1975, 1, 1)->subMonth()->month); - } - - public function testSubDaysPositive() - { - $this->assertSame(30, Carbon::createFromDate(1975, 5, 1)->subDays(1)->day); - } - - public function testSubDaysZero() - { - $this->assertSame(1, Carbon::createFromDate(1975, 5, 1)->subDays(0)->day); - } - - public function testSubDaysNegative() - { - $this->assertSame(2, Carbon::createFromDate(1975, 5, 1)->subDays(-1)->day); - } - - public function testSubDay() - { - $this->assertSame(30, Carbon::createFromDate(1975, 5, 1)->subDay()->day); - } - - public function testSubWeekdaysPositive() - { - $this->assertSame(22, Carbon::createFromDate(2012, 1, 4)->subWeekdays(9)->day); - } - - public function testSubWeekdaysZero() - { - $this->assertSame(4, Carbon::createFromDate(2012, 1, 4)->subWeekdays(0)->day); - } - - public function testSubWeekdaysNegative() - { - $this->assertSame(13, Carbon::createFromDate(2012, 1, 31)->subWeekdays(-9)->day); - } - - public function testSubWeekday() - { - $this->assertSame(6, Carbon::createFromDate(2012, 1, 9)->subWeekday()->day); - } - - public function testSubWeeksPositive() - { - $this->assertSame(14, Carbon::createFromDate(1975, 5, 21)->subWeeks(1)->day); - } - - public function testSubWeeksZero() - { - $this->assertSame(21, Carbon::createFromDate(1975, 5, 21)->subWeeks(0)->day); - } - - public function testSubWeeksNegative() - { - $this->assertSame(28, Carbon::createFromDate(1975, 5, 21)->subWeeks(-1)->day); - } - - public function testSubWeek() - { - $this->assertSame(14, Carbon::createFromDate(1975, 5, 21)->subWeek()->day); - } - - public function testSubHoursPositive() - { - $this->assertSame(23, Carbon::createFromTime(0)->subHours(1)->hour); - } - - public function testSubHoursZero() - { - $this->assertSame(0, Carbon::createFromTime(0)->subHours(0)->hour); - } - - public function testSubHoursNegative() - { - $this->assertSame(1, Carbon::createFromTime(0)->subHours(-1)->hour); - } - - public function testSubHour() - { - $this->assertSame(23, Carbon::createFromTime(0)->subHour()->hour); - } - - public function testSubMinutesPositive() - { - $this->assertSame(59, Carbon::createFromTime(0, 0)->subMinutes(1)->minute); - } - - public function testSubMinutesZero() - { - $this->assertSame(0, Carbon::createFromTime(0, 0)->subMinutes(0)->minute); - } - - public function testSubMinutesNegative() - { - $this->assertSame(1, Carbon::createFromTime(0, 0)->subMinutes(-1)->minute); - } - - public function testSubMinute() - { - $this->assertSame(59, Carbon::createFromTime(0, 0)->subMinute()->minute); - } - - public function testSubSecondsPositive() - { - $this->assertSame(59, Carbon::createFromTime(0, 0, 0)->subSeconds(1)->second); - } - - public function testSubSecondsZero() - { - $this->assertSame(0, Carbon::createFromTime(0, 0, 0)->subSeconds(0)->second); - } - - public function testSubSecondsNegative() - { - $this->assertSame(1, Carbon::createFromTime(0, 0, 0)->subSeconds(-1)->second); - } - - public function testSubSecond() - { - $this->assertSame(59, Carbon::createFromTime(0, 0, 0)->subSecond()->second); - } -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/nesbot/carbon/tests/TestFixture.php ---------------------------------------------------------------------- diff --git a/vendor/nesbot/carbon/tests/TestFixture.php b/vendor/nesbot/carbon/tests/TestFixture.php deleted file mode 100644 index 8c547c0..0000000 --- a/vendor/nesbot/carbon/tests/TestFixture.php +++ /dev/null @@ -1,56 +0,0 @@ -<?php - -/* - * This file is part of the Carbon package. - * - * (c) Brian Nesbitt <[email protected]> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -require __DIR__.'/../vendor/autoload.php'; - -use Carbon\Carbon; - -class TestFixture extends \PHPUnit_Framework_TestCase -{ - private $saveTz; - - protected function setUp() - { - //save current timezone - $this->saveTz = date_default_timezone_get(); - - date_default_timezone_set('America/Toronto'); - } - - protected function tearDown() - { - date_default_timezone_set($this->saveTz); - } - - protected function assertCarbon(Carbon $d, $year, $month, $day, $hour = null, $minute = null, $second = null) - { - $this->assertSame($year, $d->year, 'Carbon->year'); - $this->assertSame($month, $d->month, 'Carbon->month'); - $this->assertSame($day, $d->day, 'Carbon->day'); - - if ($hour !== null) { - $this->assertSame($hour, $d->hour, 'Carbon->hour'); - } - - if ($minute !== null) { - $this->assertSame($minute, $d->minute, 'Carbon->minute'); - } - - if ($second !== null) { - $this->assertSame($second, $d->second, 'Carbon->second'); - } - } - - protected function assertInstanceOfCarbon($d) - { - $this->assertInstanceOf('Carbon\Carbon', $d); - } -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/nesbot/carbon/tests/TestingAidsTest.php ---------------------------------------------------------------------- diff --git a/vendor/nesbot/carbon/tests/TestingAidsTest.php b/vendor/nesbot/carbon/tests/TestingAidsTest.php deleted file mode 100644 index 458cdff..0000000 --- a/vendor/nesbot/carbon/tests/TestingAidsTest.php +++ /dev/null @@ -1,124 +0,0 @@ -<?php - -/* - * This file is part of the Carbon package. - * - * (c) Brian Nesbitt <[email protected]> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -use Carbon\Carbon; - -class TestingAidsTest extends TestFixture -{ - public function testTestingAidsWithTestNowNotSet() - { - Carbon::setTestNow(); - - $this->assertFalse(Carbon::hasTestNow()); - $this->assertNull(Carbon::getTestNow()); - } - - public function testTestingAidsWithTestNowSet() - { - $notNow = Carbon::yesterday(); - Carbon::setTestNow($notNow); - - $this->assertTrue(Carbon::hasTestNow()); - $this->assertSame($notNow, Carbon::getTestNow()); - } - - public function testConstructorWithTestValueSet() - { - $notNow = Carbon::yesterday(); - Carbon::setTestNow($notNow); - - $this->assertEquals($notNow, new Carbon()); - $this->assertEquals($notNow, new Carbon(null)); - $this->assertEquals($notNow, new Carbon('')); - $this->assertEquals($notNow, new Carbon('now')); - } - - public function testNowWithTestValueSet() - { - $notNow = Carbon::yesterday(); - Carbon::setTestNow($notNow); - - $this->assertEquals($notNow, Carbon::now()); - } - - public function testParseWithTestValueSet() - { - $notNow = Carbon::yesterday(); - Carbon::setTestNow($notNow); - - $this->assertEquals($notNow, Carbon::parse()); - $this->assertEquals($notNow, Carbon::parse(null)); - $this->assertEquals($notNow, Carbon::parse('')); - $this->assertEquals($notNow, Carbon::parse('now')); - } - - public function testParseRelativeWithTestValueSet() - { - $notNow = Carbon::parse('2013-09-01 05:15:05'); - Carbon::setTestNow($notNow); - - $this->assertSame('2013-09-01 05:10:05', Carbon::parse('5 minutes ago')->toDateTimeString()); - - $this->assertSame('2013-08-25 05:15:05', Carbon::parse('1 week ago')->toDateTimeString()); - - $this->assertSame('2013-09-02 00:00:00', Carbon::parse('tomorrow')->toDateTimeString()); - $this->assertSame('2013-08-31 00:00:00', Carbon::parse('yesterday')->toDateTimeString()); - - $this->assertSame('2013-09-02 05:15:05', Carbon::parse('+1 day')->toDateTimeString()); - $this->assertSame('2013-08-31 05:15:05', Carbon::parse('-1 day')->toDateTimeString()); - - $this->assertSame('2013-09-02 00:00:00', Carbon::parse('next monday')->toDateTimeString()); - $this->assertSame('2013-09-03 00:00:00', Carbon::parse('next tuesday')->toDateTimeString()); - $this->assertSame('2013-09-04 00:00:00', Carbon::parse('next wednesday')->toDateTimeString()); - $this->assertSame('2013-09-05 00:00:00', Carbon::parse('next thursday')->toDateTimeString()); - $this->assertSame('2013-09-06 00:00:00', Carbon::parse('next friday')->toDateTimeString()); - $this->assertSame('2013-09-07 00:00:00', Carbon::parse('next saturday')->toDateTimeString()); - $this->assertSame('2013-09-08 00:00:00', Carbon::parse('next sunday')->toDateTimeString()); - - $this->assertSame('2013-08-26 00:00:00', Carbon::parse('last monday')->toDateTimeString()); - $this->assertSame('2013-08-27 00:00:00', Carbon::parse('last tuesday')->toDateTimeString()); - $this->assertSame('2013-08-28 00:00:00', Carbon::parse('last wednesday')->toDateTimeString()); - $this->assertSame('2013-08-29 00:00:00', Carbon::parse('last thursday')->toDateTimeString()); - $this->assertSame('2013-08-30 00:00:00', Carbon::parse('last friday')->toDateTimeString()); - $this->assertSame('2013-08-31 00:00:00', Carbon::parse('last saturday')->toDateTimeString()); - $this->assertSame('2013-08-25 00:00:00', Carbon::parse('last sunday')->toDateTimeString()); - - $this->assertSame('2013-09-02 00:00:00', Carbon::parse('this monday')->toDateTimeString()); - $this->assertSame('2013-09-03 00:00:00', Carbon::parse('this tuesday')->toDateTimeString()); - $this->assertSame('2013-09-04 00:00:00', Carbon::parse('this wednesday')->toDateTimeString()); - $this->assertSame('2013-09-05 00:00:00', Carbon::parse('this thursday')->toDateTimeString()); - $this->assertSame('2013-09-06 00:00:00', Carbon::parse('this friday')->toDateTimeString()); - $this->assertSame('2013-09-07 00:00:00', Carbon::parse('this saturday')->toDateTimeString()); - $this->assertSame('2013-09-01 00:00:00', Carbon::parse('this sunday')->toDateTimeString()); - - $this->assertSame('2013-10-01 05:15:05', Carbon::parse('first day of next month')->toDateTimeString()); - $this->assertSame('2013-09-30 05:15:05', Carbon::parse('last day of this month')->toDateTimeString()); - } - - public function testParseRelativeWithMinusSignsInDate() - { - $notNow = Carbon::parse('2013-09-01 05:15:05'); - Carbon::setTestNow($notNow); - - $this->assertSame('2000-01-03 00:00:00', Carbon::parse('2000-1-3')->toDateTimeString()); - $this->assertSame('2000-10-10 00:00:00', Carbon::parse('2000-10-10')->toDateTimeString()); - } - - public function testTimeZoneWithTestValueSet() - { - $notNow = Carbon::parse('2013-07-01 12:00:00', 'America/New_York'); - Carbon::setTestNow($notNow); - - $this->assertSame('2013-07-01T12:00:00-0400', Carbon::parse('now')->toIso8601String()); - $this->assertSame('2013-07-01T11:00:00-0500', Carbon::parse('now', 'America/Mexico_City')->toIso8601String()); - $this->assertSame('2013-07-01T09:00:00-0700', Carbon::parse('now', 'America/Vancouver')->toIso8601String()); - } -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/nikic/php-parser/.travis.yml ---------------------------------------------------------------------- diff --git a/vendor/nikic/php-parser/.travis.yml b/vendor/nikic/php-parser/.travis.yml deleted file mode 100644 index e1f7506..0000000 --- a/vendor/nikic/php-parser/.travis.yml +++ /dev/null @@ -1,13 +0,0 @@ -language: php - -php: - - 5.2 - - 5.3 - - 5.4 - - 5.5 - - hhvm - -matrix: - allow_failures: - - php: hhvm - fast_finish: true http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/nikic/php-parser/CHANGELOG.md ---------------------------------------------------------------------- diff --git a/vendor/nikic/php-parser/CHANGELOG.md b/vendor/nikic/php-parser/CHANGELOG.md deleted file mode 100644 index b22b35f..0000000 --- a/vendor/nikic/php-parser/CHANGELOG.md +++ /dev/null @@ -1,168 +0,0 @@ -Version 0.9.5 (23.07.2014) --------------------------- - -**This is the last release on the 0.9 branch.** - -* Add `NodeTraverser::removeVisitor()` method, which removes a visitor from the node traverser. The method was not added - to the corresponding `NodeTraverserInterface` to avoid BC breaks with custom traversers (it is added in version 1.0). - -* Deprecated `PHPParser_Template` and `PHPParser_TemplateLoader`. This functionality does not belong in the main project - and - as far as I know - nobody is using it. - -* Fix alias resolution in `NameResolver`: Class names are now correctly handled as case-insensitive. - -* The undefined variable error, which is used in the lexer to reset the error state, will no longer interfere with - custom error handlers. - -* Make lexer compatible with `xdebug.scream`. - -Version 0.9.4 (25.08.2013) --------------------------- -* [PHP 5.5] Add support for `ClassName::class`. This is parsed as an `Expr_ClassConstFetch` with `'class'` being the - constant name. - -* Syntax errors now include information on expected tokens and mimic the format of PHP's own (pre 5.4) error messages. - Example: - - Old: Unexpected token T_STATIC on line 1 - New: Syntax error, unexpected T_STATIC, expecting T_STRING or T_NS_SEPARATOR or '{' - -* `PHPParser_PrettyPrinter_Zend` was renamed to `PHPParser_PrettyPrinter_Default` as the default pretty printer only - very loosely applies the Zend Coding Standard. The class `PHPParser_PrettyPrinter_Zend` extends - `PHPParser_PrettyPrinter_Default` to maintain backwards compatibility. - -* The pretty printer now prints namespaces in semicolon-style if possible (i.e. if the file does not contain a global - namespace declaration). - -* Added `prettyPrintFile(array $stmts)` method which will pretty print a file of statements including the opening - `<?php` tag if it is required. Use of this method will also eliminate the unnecessary `<?php ?>` at the start and end - of files using inline HTML. - -* There now is a builder for interfaces (`PHPParser_Builder_Interface`). - -* An interface for the node traversation has been added: `PHPParser_NodeTraverserInterface` - -* Fix pretty printing of `include` expressions (precedence information was missing). - -* Fix "undefined index" notices when generating the expected tokens for a syntax error. - -* Improve performance of `PrettyPrinter` construction by no longer using the `uniqid()` function. - -Version 0.9.3 (22.11.2012) --------------------------- - -* [BC] As `list()` in `foreach` is now supported the structure of list assignments changed: - - 1. There is no longer a dedicated `AssignList` node; instead a normal `Assign` node is used with a `List` as `var`. - 2. Nested lists are now `List` nodes too, instead of just arrays. - -* [BC] As arbitrary expressions are allowed in `empty()` now its subnode was renamed from `var` to `expr`. - -* [BC] The protected `pSafe()` method in `PrettyPrinterAbstract` was renamed to `pNoIndent()`. - -* [PHP 5.5] Add support for arbitrary expressions in `empty()`. - -* [PHP 5.5] Add support for constant array / string dereferencing. - Examples: `"foo"[2]`, `[1, 2, 3][2]` - -* [PHP 5.5] Add support for `yield` expressions. This adds a new `Yield` expression type, with subnodes `key` and - `value`. - -* [PHP 5.5] Add support for `finally`. This adds a new `finallyStmts` subnode to the `TryCatch` node. If there is no - finally clause it will be `null`. - -* [PHP 5.5] Add support for `list()` destructuring of `foreach` values. - Example: `foreach ($coords as list($x, $y)) { ... }` - -* Improve pretty printing of expressions by printing less unnecessary parentheses. In particular concatenations are now - printed as `$a . $b . $c . $d . $e` rather than `$a . ($b . ($c . ($d . $e)))`. This is implemented by taking operator - associativity into account. New protected methods added to the pretty printer are `pPrec()`, `pInfixOp()`, - `pPrefixOp()` and `pPostfixOp()`. This also fixes an issue with extraneous parentheses in closure bodies. - -* Fix formatting of fall-through `case` statements in the Zend pretty printer. - -* Fix parsing of `$foo =& new Bar`. It is now properly parsed as `AssignRef` (instead of `Assign`). - -* Fix assignment of `$endAttributes`. Sometimes the attributes of the token right after the node were assigned, rather - than the attributes of the last token in the node. - -* `rebuildParser.php` is now designed to be run from the command line rather than from the browser. - -Version 0.9.2 (07.07.2012) --------------------------- - -* Add `Class->getMethods()` function, which returns all methods contained in the `stmts` array of the class node. This - does not take inherited methods into account. - -* Add `isPublic()`, `isProtected()`, `isPrivate()`. `isAbstract()`, `isFinal()` and `isStatic()` accessors to the - `ClassMethod`, `Property` and `Class` nodes. (`Property` and `Class` obviously only have the accessors relevant to - them.) - -* Fix parsing of new expressions in parentheses, e.g. `return(new Foo);`. - -* [BC] Due to the below changes nodes now optionally accept an `$attributes` array as the - last parameter, instead of the previously used `$line` and `$docComment` parameters. - -* Add mechanism for adding attributes to nodes in the lexer. - - The following attributes are now added by default: - - * `startLine`: The line the node started in. - * `endLine`: The line the node ended in. - * `comments`: An array of comments. The comments are instances of `PHPParser_Comment` - (or `PHPParser_Comment_Doc` for doc comments). - - The methods `getLine()` and `setLine()` still exist and function as before, but internally - operator on the `startLine` attribute. - - `getDocComment()` also continues to exist. It returns the last comment in the `comments` - attribute if it is a doc comment, otherwise `null`. As `getDocComment()` now returns a - comment object (which can be modified using `->setText()`) the `setDocComment()` method was - removed. Comment objects implement a `__toString()` method, so `getDocComment()` should - continue to work properly with old code. - -* [BC] Use inject-once approach for lexer: - - Now the lexer is injected only once when creating the parser. Instead of - - $parser = new PHPParser_Parser; - $parser->parse(new PHPParser_Lexer($code)); - $parser->parse(new PHPParser_Lexer($code2)); - - you write: - - $parser = new PHPParser_Parser(new PHPParser_Lexer); - $parser->parse($code); - $parser->parse($code2); - -* Fix `NameResolver` visitor to also resolve class names in `catch` blocks. - -Version 0.9.1 (24.04.2012) --------------------------- - -* Add ability to add attributes to nodes: - - It is now possible to add attributes to a node using `$node->setAttribute('name', 'value')` and to retrieve them using - `$node->getAttribute('name' [, 'default'])`. Additionally the existance of an attribute can be checked with - `$node->hasAttribute('name')` and all attributes can be returned using `$node->getAttributes()`. - -* Add code generation features: Builders and templates. - - For more infos, see the [code generation documentation][1]. - -* [BC] Don't traverse nodes merged by another visitor: - - If a NodeVisitor returns an array of nodes to merge, these will no longer be traversed by all other visitors. This - behavior only caused problems. - -* Fix line numbers for some list structures. -* Fix XML unserialization of empty nodes. -* Fix parsing of integers that overflow into floats. -* Fix emulation of NOWDOC and binary floats. - -Version 0.9.0 (05.01.2012) --------------------------- - -First version. - - [1]: https://github.com/nikic/PHP-Parser/blob/master/doc/3_Code_generation.markdown \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/nikic/php-parser/LICENSE ---------------------------------------------------------------------- diff --git a/vendor/nikic/php-parser/LICENSE b/vendor/nikic/php-parser/LICENSE deleted file mode 100644 index 443210b..0000000 --- a/vendor/nikic/php-parser/LICENSE +++ /dev/null @@ -1,31 +0,0 @@ -Copyright (c) 2011 by Nikita Popov. - -Some rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - - * The names of the contributors may not be used to endorse or - promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/nikic/php-parser/README.md ---------------------------------------------------------------------- diff --git a/vendor/nikic/php-parser/README.md b/vendor/nikic/php-parser/README.md deleted file mode 100644 index 8711eab..0000000 --- a/vendor/nikic/php-parser/README.md +++ /dev/null @@ -1,78 +0,0 @@ -PHP Parser -========== - -This is a PHP 5.5 (and older) parser written in PHP. It's purpose is to simplify static code analysis and -manipulation. - -Documentation can be found in the [`doc/`][1] directory. - -***Note: This project is experimental, so the API is subject to change.*** - -In a Nutshell -------------- - -Basically, the parser does nothing more than turn some PHP code into an abstract syntax tree. ("nothing -more" is kind of sarcastic here as PHP has a ... uhm, let's just say "not nice" ... grammar, which makes -parsing PHP very hard.) - -For example, if you stick this code in the parser: - -```php -<?php -echo 'Hi', 'World'; -hello\world('foo', 'bar' . 'baz'); -``` - -You'll get a syntax tree looking roughly like this: - -``` -array( - 0: Stmt_Echo( - exprs: array( - 0: Scalar_String( - value: Hi - ) - 1: Scalar_String( - value: World - ) - ) - ) - 1: Expr_FuncCall( - name: Name( - parts: array( - 0: hello - 1: world - ) - ) - args: array( - 0: Arg( - value: Scalar_String( - value: foo - ) - byRef: false - ) - 1: Arg( - value: Expr_Concat( - left: Scalar_String( - value: bar - ) - right: Scalar_String( - value: baz - ) - ) - byRef: false - ) - ) - ) -) -``` - -You can then work with this syntax tree, for example to statically analyze the code (e.g. to find -programming errors or security issues). - -Additionally, you can convert a syntax tree back to PHP code. This allows you to do code preprocessing -(like automatedly porting code to older PHP versions). - -So, that's it, in a nutshell. You can find everything else in the [docs][1]. - - [1]: https://github.com/nikic/PHP-Parser/tree/master/doc \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/nikic/php-parser/composer.json ---------------------------------------------------------------------- diff --git a/vendor/nikic/php-parser/composer.json b/vendor/nikic/php-parser/composer.json deleted file mode 100644 index 372165d..0000000 --- a/vendor/nikic/php-parser/composer.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "nikic/php-parser", - "description": "A PHP parser written in PHP", - "keywords": ["php", "parser"], - "type": "library", - "license": "BSD-3-Clause", - "authors": [ - { - "name": "Nikita Popov" - } - ], - "require": { - "php": ">=5.2", - "ext-tokenizer": "*" - }, - "autoload": { - "psr-0": { "PHPParser": "lib/" } - }, - "extra": { - "branch-alias": { - "dev-master": "0.9-dev" - } - } -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/nikic/php-parser/doc/0_Introduction.markdown ---------------------------------------------------------------------- diff --git a/vendor/nikic/php-parser/doc/0_Introduction.markdown b/vendor/nikic/php-parser/doc/0_Introduction.markdown deleted file mode 100644 index d4b0b7b..0000000 --- a/vendor/nikic/php-parser/doc/0_Introduction.markdown +++ /dev/null @@ -1,81 +0,0 @@ -Introduction -============ - -This project is a PHP 5.5 (and older) parser **written in PHP itself**. - -What is this for? ------------------ - -A parser is useful for [static analysis][0] and manipulation of code and basically any other -application dealing with code programmatically. A parser constructs an [Abstract Syntax Tree][1] -(AST) of the code and thus allows dealing with it in an abstract and robust way. - -There are other ways of dealing with source code. One that PHP supports natively is using the -token stream generated by [`token_get_all`][2]. The token stream is much more low level than -the AST and thus has different applications: It allows to also analyze the exact formatting of -a file. On the other hand the token stream is much harder to deal with for more complex analysis. -For example an AST abstracts away the fact that in PHP variables can be written as `$foo`, but also -as `$$bar`, `${'foobar'}` or even `${!${''}=barfoo()}`. You don't have to worry about recognizing -all the different syntaxes from a stream of tokens. - -Another questions is: Why would I want to have a PHP parser *written in PHP*? Well, PHP might not be -a language especially suited for fast parsing, but processing the AST is much easier in PHP than it -would be in other, faster languages like C. Furthermore the people most probably wanting to do -programmatic PHP code analysis are incidentally PHP developers, not C developers. - -What can it parse? ------------------- - -The parser uses a PHP 5.5 compliant grammar, which is backwards compatible with at least PHP 5.4, PHP 5.3 -and PHP 5.2 (and maybe older). - -As the parser is based on the tokens returned by `token_get_all` (which is only able to lex the PHP -version it runs on), additionally a wrapper for emulating new tokens from 5.3, 5.4 and 5.5 is provided. This -allows to parse PHP 5.5 source code running on PHP 5.2, for example. This emulation is very hacky and not -yet perfect, but it should work well on any sane code. - -What output does it produce? ----------------------------- - -The parser produces an [Abstract Syntax Tree][1] (AST) also known as a node tree. How this looks like -can best be seen in an example. The program `<?php echo 'Hi', 'World';` will give you a node tree -roughly looking like this: - -``` -array( - 0: Stmt_Echo( - exprs: array( - 0: Scalar_String( - value: Hi - ) - 1: Scalar_String( - value: World - ) - ) - ) -) -``` - -This matches the semantics the program had: An echo statement, which takes two strings as expressions, -with the values `Hi` and `World!`. - -You can also see that the AST does not contain any whitespace information (but most comments are saved). -So using it for formatting analysis is not possible. - -What else can it do? --------------------- - -Apart from the parser itself this package also bundles support for some other, related features: - - * Support for pretty printing, which is the act of converting an AST into PHP code. Please note - that "pretty printing" does not imply that the output is especially pretty. It's just how it's - called ;) - * Support for serializing and unserializing the node tree to XML - * Support for dumping the node tree in a human readable form (see the section above for an - example of how the output looks like) - * Infrastructure for traversing and changing the AST (node traverser and node visitors) - * A node visitor for resolving namespaced names - - [0]: http://en.wikipedia.org/wiki/Static_program_analysis - [1]: http://en.wikipedia.org/wiki/Abstract_syntax_tree - [2]: http://php.net/token_get_all \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/nikic/php-parser/doc/1_Installation.markdown ---------------------------------------------------------------------- diff --git a/vendor/nikic/php-parser/doc/1_Installation.markdown b/vendor/nikic/php-parser/doc/1_Installation.markdown deleted file mode 100644 index 082bd77..0000000 --- a/vendor/nikic/php-parser/doc/1_Installation.markdown +++ /dev/null @@ -1,48 +0,0 @@ -Installation -============ - -There are multiple ways to include the PHP parser into your project: - -Installing from the Zip- or Tarball ------------------------------------ - -Download the latest version from [the download page][2], unpack it and move the files somewhere into your project. - -Installing via Composer ------------------------ - -Create a `composer.json` file in your project root and use it to define your dependencies: - - { - "require": { - "nikic/php-parser": "0.9.5" - } - } - -Then install Composer in your project (or [download the composer.phar][1] directly): - - curl -s http://getcomposer.org/installer | php - -And finally ask Composer to install the dependencies: - - php composer.phar install - -Installing as a PEAR package ----------------------------- - -Run the following two commands: - - pear channel-discover nikic.github.com/pear - pear install nikic/PHPParser-0.9.5 - -Installing as a Git Submodule ------------------------------ - -Run the following command to install the parser into the `vendor/PHP-Parser` folder: - - git submodule add git://github.com/nikic/PHP-Parser.git vendor/PHP-Parser - - - - [1]: http://getcomposer.org/composer.phar - [2]: https://github.com/nikic/PHP-Parser/tags \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/nikic/php-parser/doc/2_Usage_of_basic_components.markdown ---------------------------------------------------------------------- diff --git a/vendor/nikic/php-parser/doc/2_Usage_of_basic_components.markdown b/vendor/nikic/php-parser/doc/2_Usage_of_basic_components.markdown deleted file mode 100644 index b4d5599..0000000 --- a/vendor/nikic/php-parser/doc/2_Usage_of_basic_components.markdown +++ /dev/null @@ -1,394 +0,0 @@ -Usage of basic components -========================= - -This document explains how to use the parser, the pretty printer and the node traverser. - -Bootstrapping -------------- - -The library needs to register a class autoloader; this is done by including the -`bootstrap.php` file: - -```php -<?php -require 'path/to/PHP-Parser/lib/bootstrap.php'; -``` - -Additionally you may want to set the `xdebug.max_nesting_level` ini option to a higher value: - -```php -<?php -ini_set('xdebug.max_nesting_level', 2000); -``` - -This ensures that there will be no errors when traversing highly nested node trees. - -Parsing -------- - -In order to parse some source code you first have to create a `PHPParser_Parser` object (which -needs to be passed a `PHPParser_Lexer` instance) and then pass the code (including `<?php` opening -tags) to the `parse` method. If a syntax error is encountered `PHPParser_Error` is thrown, so this -exception should be `catch`ed. - -```php -<?php -$code = '<?php // some code'; - -$parser = new PHPParser_Parser(new PHPParser_Lexer); - -try { - $stmts = $parser->parse($code); -} catch (PHPParser_Error $e) { - echo 'Parse Error: ', $e->getMessage(); -} -``` - -The `parse` method will return an array of statement nodes (`$stmts`). - -### Emulative lexer - -Instead of `PHPParser_Lexer` one can also use `PHPParser_Lexer_Emulative`. This class will emulate tokens -of newer PHP versions and as such allow parsing PHP 5.5 on PHP 5.2, for example. So if you want to parse -PHP code of newer versions than the one you are running, you should use the emulative lexer. - -Node tree ---------- - -If you use the above code with `$code = "<?php echo 'Hi ', hi\\getTarget();"` the parser will -generate a node tree looking like this: - -``` -array( - 0: Stmt_Echo( - exprs: array( - 0: Scalar_String( - value: Hi - ) - 1: Expr_FuncCall( - name: Name( - parts: array( - 0: hi - 1: getTarget - ) - ) - args: array( - ) - ) - ) - ) -) -``` - -Thus `$stmts` will contain an array with only one node, with this node being an instance of -`PHPParser_Node_Stmt_Echo`. - -As PHP is a large language there are approximately 140 different nodes. In order to make work -with them easier they are grouped into three categories: - - * `PHPParser_Node_Stmt`s are statement nodes, i.e. language constructs that do not return - a value and can not occur in an expression. For example a class definition is a statement. - It doesn't return a value and you can't write something like `func(class A {});`. - * `PHPParser_Node_Expr`s are expression nodes, i.e. language constructs that return a value - and thus can occur in other expressions. Examples of expressions are `$var` - (`PHPParser_Node_Expr_Variable`) and `func()` (`PHPParser_Node_Expr_FuncCall`). - * `PHPParser_Node_Scalar`s are nodes representing scalar values, like `'string'` - (`PHPParser_Node_Scalar_String`), `0` (`PHPParser_Node_Scalar_LNumber`) or magic constants - like `__FILE__` (`PHPParser_Node_Scalar_FileConst`). All `PHPParser_Node_Scalar`s extend - `PHPParser_Node_Expr`, as scalars are expressions, too. - * There are some nodes not in either of these groups, for example names (`PHPParser_Node_Name`) - and call arguments (`PHPParser_Node_Arg`). - -Every node has a (possibly zero) number of subnodes. You can access subnodes by writing -`$node->subNodeName`. The `Stmt_Echo` node has only one subnode `exprs`. So in order to access it -in the above example you would write `$stmts[0]->exprs`. If you wanted to access name of the function -call, you would write `$stmts[0]->exprs[1]->name`. - -All nodes also define a `getType()` method that returns the node type (the type is the class name -without the `PHPParser_Node_` prefix). - -It is possible to associate custom metadata with a node using the `setAttribute()` method. This data -can then be retrieved using `hasAttribute()`, `getAttribute()` and `getAttributes()`. - -By default the lexer adds the `startLine`, `endLine` and `comments` attributes. `comments` is an array -of `PHPParser_Comment[_Doc]` instances. - -The start line can also be accessed using `getLine()`/`setLine()` (instead of `getAttribute('startLine')`). -The last doc comment from the `comments` attribute can be obtained using `getDocComment()`. - -Pretty printer --------------- - -The pretty printer component compiles the AST back to PHP code. As the parser does not retain formatting -information the formatting is done using a specified scheme. Currently there is only one scheme available, -namely `PHPParser_PrettyPrinter_Default`. - -```php -<?php -$code = "<?php echo 'Hi ', hi\\getTarget();"; - -$parser = new PHPParser_Parser(new PHPParser_Lexer); -$prettyPrinter = new PHPParser_PrettyPrinter_Default; - -try { - // parse - $stmts = $parser->parse($code); - - // change - $stmts[0] // the echo statement - ->exprs // sub expressions - [0] // the first of them (the string node) - ->value // it's value, i.e. 'Hi ' - = 'Hallo '; // change to 'Hallo ' - - // pretty print - $code = '<?php ' . $prettyPrinter->prettyPrint($stmts); - - echo $code; -} catch (PHPParser_Error $e) { - echo 'Parse Error: ', $e->getMessage(); -} -``` - -The above code will output: - - <?php echo 'Hallo ', hi\getTarget(); - -As you can see the source code was first parsed using `PHPParser_Parser->parse`, then changed and then -again converted to code using `PHPParser_PrettyPrinter_Default->prettyPrint`. - -The `prettyPrint` method pretty prints a statements array. It is also possible to pretty print only a -single expression using `prettyPrintExpr`. - -Node traversation ------------------ - -The above pretty printing example used the fact that the source code was known and thus it was easy to -write code that accesses a certain part of a node tree and changes it. Normally this is not the case. -Usually you want to change / analyze code in a generic way, where you don't know how the node tree is -going to look like. - -For this purpose the parser provides a component for traversing and visiting the node tree. The basic -structure of a program using this `PHPParser_NodeTraverser` looks like this: - -```php -<?php -$code = "<?php // some code"; - -$parser = new PHPParser_Parser(new PHPParser_Lexer); -$traverser = new PHPParser_NodeTraverser; -$prettyPrinter = new PHPParser_PrettyPrinter_Default; - -// add your visitor -$traverser->addVisitor(new MyNodeVisitor); - -try { - // parse - $stmts = $parser->parse($code); - - // traverse - $stmts = $traverser->traverse($stmts); - - // pretty print - $code = '<?php ' . $prettyPrinter->prettyPrint($stmts); - - echo $code; -} catch (PHPParser_Error $e) { - echo 'Parse Error: ', $e->getMessage(); -} -``` - -A same node visitor for this code might look like this: - -```php -<?php -class MyNodeVisitor extends PHPParser_NodeVisitorAbstract -{ - public function leaveNode(PHPParser_Node $node) { - if ($node instanceof PHPParser_Node_Scalar_String) { - $node->value = 'foo'; - } - } -} -``` - -The above node visitor would change all string literals in the program to `'foo'`. - -All visitors must implement the `PHPParser_NodeVisitor` interface, which defined the following four -methods: - - public function beforeTraverse(array $nodes); - public function enterNode(PHPParser_Node $node); - public function leaveNode(PHPParser_Node $node); - public function afterTraverse(array $nodes); - -The `beforeTraverse` method is called once before the traversal begins and is passed the nodes the -traverser was called with. This method can be used for resetting values before traversation or -preparing the tree for traversal. - -The `afterTraverse` method is similar to the `beforeTraverse` method, with the only difference that -it is called once after the traversal. - -The `enterNode` and `leaveNode` methods are called on every node, the former when it is entered, -i.e. before its subnodes are traversed, the latter when it is left. - -All four methods can either return the changed node or not return at all (i.e. `null`) in which -case the current node is not changed. The `leaveNode` method can furthermore return two special -values: If `false` is returned the current node will be removed from the parent array. If an `array` -is returned the current node will be merged into the parent array at the offset of the current node. -I.e. if in `array(A, B, C)` the node `B` should be replaced with `array(X, Y, Z)` the result will be -`array(A, X, Y, Z, C)`. - -Instead of manually implementing the `NodeVisitor` interface you can also extend the `NodeVisitorAbstract` -class, which will define empty default implementations for all the above methods. - -The NameResolver node visitor ------------------------------ - -One visitor is already bundled with the package: `PHPParser_NodeVisitor_NameResolver`. This visitor -helps you work with namespaced code by trying to resolve most names to fully qualified ones. - -For example, consider the following code: - - use A as B; - new B\C(); - -In order to know that `B\C` really is `A\C` you would need to track aliases and namespaces yourself. -The `NameResolver` takes care of that and resolves names as far as possible. - -After running it most names will be fully qualified. The only names that will stay unqualified are -unqualified function and constant names. These are resolved at runtime and thus the visitor can't -know which function they are referring to. In most cases this is a non-issue as the global functions -are meant. - -Also the `NameResolver` adds a `namespacedName` subnode to class, function and constant declarations -that contains the namespaced name instead of only the shortname that is available via `name`. - -Example: Converting namespaced code to pseudo namespaces --------------------------------------------------------- - -A small example to understand the concept: We want to convert namespaced code to pseudo namespaces -so it works on 5.2, i.e. names like `A\\B` should be converted to `A_B`. Note that such conversions -are fairly complicated if you take PHP's dynamic features into account, so our conversion will -assume that no dynamic features are used. - -We start off with the following base code: - -```php -<?php -const IN_DIR = '/some/path'; -const OUT_DIR = '/some/other/path'; - -// use the emulative lexer here, as we are running PHP 5.2 but want to parse PHP 5.3 -$parser = new PHPParser_Parser(new PHPParser_Lexer_Emulative); -$traverser = new PHPParser_NodeTraverser; -$prettyPrinter = new PHPParser_PrettyPrinter_Default; - -$traverser->addVisitor(new PHPParser_NodeVisitor_NameResolver); // we will need resolved names -$traverser->addVisitor(new NodeVisitor_NamespaceConverter); // our own node visitor - -// iterate over all .php files in the directory -$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(IN_DIR)); -$files = new RegexIterator($files, '/\.php$/'); - -foreach ($files as $file) { - try { - // read the file that should be converted - $code = file_get_contents($file); - - // parse - $stmts = $parser->parse($code); - - // traverse - $stmts = $traverser->traverse($stmts); - - // pretty print - $code = '<?php ' . $prettyPrinter->prettyPrint($stmts); - - // write the converted file to the target directory - file_put_contents( - substr_replace($file->getPathname(), OUT_DIR, 0, strlen(IN_DIR)), - $code - ); - } catch (PHPParser_Error $e) { - echo 'Parse Error: ', $e->getMessage(); - } -} -``` - -Now lets start with the main code, the `NodeVisitor_NamespaceConverter`. One thing it needs to do -is convert `A\\B` style names to `A_B` style ones. - -```php -<?php -class NodeVisitor_NamespaceConverter extends PHPParser_NodeVisitorAbstract -{ - public function leaveNode(PHPParser_Node $node) { - if ($node instanceof PHPParser_Node_Name) { - return new PHPParser_Node_Name($node->toString('_')); - } - } -} -``` - -The above code profits from the fact that the `NameResolver` already resolved all names as far as -possible, so we don't need to do that. All the need to create a string with the name parts separated -by underscores instead of backslashes. This is what `$node->toString('_')` does. (If you want to -create a name with backslashes either write `$node->toString()` or `(string) $node`.) Then we create -a new name from the string and return it. Returning a new node replaces the old node. - -Another thing we need to do is change the class/function/const declarations. Currently they contain -only the shortname (i.e. the last part of the name), but they need to contain the complete class -name: - -```php -<?php -class NodeVisitor_NamespaceConverter extends PHPParser_NodeVisitorAbstract -{ - public function leaveNode(PHPParser_Node $node) { - if ($node instanceof PHPParser_Node_Name) { - return new PHPParser_Node_Name($node->toString('_')); - } elseif ($node instanceof PHPParser_Node_Stmt_Class - || $node instanceof PHPParser_Node_Stmt_Interface - || $node instanceof PHPParser_Node_Stmt_Function) { - $node->name = $node->namespacedName->toString('_'); - } elseif ($node instanceof PHPParser_Node_Stmt_Const) { - foreach ($node->consts as $const) { - $const->name = $const->namespacedName->toString('_'); - } - } - } -} -``` - -There is not much more to it than converting the namespaced name to string with `_` as separator. - -The last thing we need to do is remove the `namespace` and `use` statements: - -```php -<?php -class NodeVisitor_NamespaceConverter extends PHPParser_NodeVisitorAbstract -{ - public function leaveNode(PHPParser_Node $node) { - if ($node instanceof PHPParser_Node_Name) { - return new PHPParser_Node_Name($node->toString('_')); - } elseif ($node instanceof PHPParser_Node_Stmt_Class - || $node instanceof PHPParser_Node_Stmt_Interface - || $node instanceof PHPParser_Node_Stmt_Function) { - $node->name = $node->namespacedName->toString('_'); - } elseif ($node instanceof PHPParser_Node_Stmt_Const) { - foreach ($node->consts as $const) { - $const->name = $const->namespacedName->toString('_'); - } - } elseif ($node instanceof PHPParser_Node_Stmt_Namespace) { - // returning an array merges is into the parent array - return $node->stmts; - } elseif ($node instanceof PHPParser_Node_Stmt_Use) { - // returning false removed the node altogether - return false; - } - } -} -``` - -That's all. \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/nikic/php-parser/doc/3_Other_node_tree_representations.markdown ---------------------------------------------------------------------- diff --git a/vendor/nikic/php-parser/doc/3_Other_node_tree_representations.markdown b/vendor/nikic/php-parser/doc/3_Other_node_tree_representations.markdown deleted file mode 100644 index e4fc080..0000000 --- a/vendor/nikic/php-parser/doc/3_Other_node_tree_representations.markdown +++ /dev/null @@ -1,201 +0,0 @@ -Other node tree representations -=============================== - -It is possible to convert the AST in several textual representations, which serve different uses. - -Simple serialization --------------------- - -It is possible to serialize the node tree using `serialize()` and also unserialize it using -`unserialize()`. The output is not human readable and not easily processable from anything -but PHP, but it is compact and generates fast. The main application thus is in caching. - -Human readable dumping ----------------------- - -Furthermore it is possible to dump nodes into a human readable form using the `dump` method of -`PHPParser_NodeDumper`. This can be used for debugging. - -```php -<?php -$code = <<<'CODE' -<?php - function printLine($msg) { - echo $msg, "\n"; - } - - printLine('Hallo World!!!'); -CODE; - -$parser = new PHPParser_Parser(new PHPParser_Lexer); -$nodeDumper = new PHPParser_NodeDumper; - -try { - $stmts = $parser->parse($code); - - echo '<pre>' . htmlspecialchars($nodeDumper->dump($stmts)) . '</pre>'; -} catch (PHPParser_Error $e) { - echo 'Parse Error: ', $e->getMessage(); -} -``` - -The above output will have an output looking roughly like this: - -``` -array( - 0: Stmt_Function( - byRef: false - params: array( - 0: Param( - name: msg - default: null - type: null - byRef: false - ) - ) - stmts: array( - 0: Stmt_Echo( - exprs: array( - 0: Expr_Variable( - name: msg - ) - 1: Scalar_String( - value: - - ) - ) - ) - ) - name: printLine - ) - 1: Expr_FuncCall( - name: Name( - parts: array( - 0: printLine - ) - ) - args: array( - 0: Arg( - value: Scalar_String( - value: Hallo World!!! - ) - byRef: false - ) - ) - ) -) -``` - -Serialization to XML --------------------- - -It is also possible to serialize the node tree to XML using `PHPParser_Serializer_XML->serialize()` -and to unserialize it using `PHPParser_Unserializer_XML->unserialize()`. This is useful for -interfacing with other languages and applications or for doing transformation using XSLT. - -```php -<?php -$code = <<<'CODE' -<?php - function printLine($msg) { - echo $msg, "\n"; - } - - printLine('Hallo World!!!'); -CODE; - -$parser = new PHPParser_Parser(new PHPParser_Lexer); -$serializer = new PHPParser_Serializer_XML; - -try { - $stmts = $parser->parse($code); - - echo '<pre>' . htmlspecialchars($serializer->serialize($stmts)) . '</pre>'; -} catch (PHPParser_Error $e) { - echo 'Parse Error: ', $e->getMessage(); -} -``` - -Produces: - -```xml -<?xml version="1.0" encoding="UTF-8"?> -<AST xmlns:node="http://nikic.github.com/PHPParser/XML/node" xmlns:subNode="http://nikic.github.com/PHPParser/XML/subNode" xmlns:scalar="http://nikic.github.com/PHPParser/XML/scalar"> - <scalar:array> - <node:Stmt_Function line="2"> - <subNode:byRef> - <scalar:false/> - </subNode:byRef> - <subNode:params> - <scalar:array> - <node:Param line="2"> - <subNode:name> - <scalar:string>msg</scalar:string> - </subNode:name> - <subNode:default> - <scalar:null/> - </subNode:default> - <subNode:type> - <scalar:null/> - </subNode:type> - <subNode:byRef> - <scalar:false/> - </subNode:byRef> - </node:Param> - </scalar:array> - </subNode:params> - <subNode:stmts> - <scalar:array> - <node:Stmt_Echo line="3"> - <subNode:exprs> - <scalar:array> - <node:Expr_Variable line="3"> - <subNode:name> - <scalar:string>msg</scalar:string> - </subNode:name> - </node:Expr_Variable> - <node:Scalar_String line="3"> - <subNode:value> - <scalar:string> -</scalar:string> - </subNode:value> - </node:Scalar_String> - </scalar:array> - </subNode:exprs> - </node:Stmt_Echo> - </scalar:array> - </subNode:stmts> - <subNode:name> - <scalar:string>printLine</scalar:string> - </subNode:name> - </node:Stmt_Function> - <node:Expr_FuncCall line="6"> - <subNode:name> - <node:Name line="6"> - <subNode:parts> - <scalar:array> - <scalar:string>printLine</scalar:string> - </scalar:array> - </subNode:parts> - </node:Name> - </subNode:name> - <subNode:args> - <scalar:array> - <node:Arg line="6"> - <subNode:value> - <node:Scalar_String line="6"> - <subNode:value> - <scalar:string>Hallo World!!!</scalar:string> - </subNode:value> - </node:Scalar_String> - </subNode:value> - <subNode:byRef> - <scalar:false/> - </subNode:byRef> - </node:Arg> - </scalar:array> - </subNode:args> - </node:Expr_FuncCall> - </scalar:array> -</AST> -``` \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/nikic/php-parser/doc/4_Code_generation.markdown ---------------------------------------------------------------------- diff --git a/vendor/nikic/php-parser/doc/4_Code_generation.markdown b/vendor/nikic/php-parser/doc/4_Code_generation.markdown deleted file mode 100644 index 10c6c60..0000000 --- a/vendor/nikic/php-parser/doc/4_Code_generation.markdown +++ /dev/null @@ -1,267 +0,0 @@ -Code generation -=============== - -It is also possible to generate code using the parser, by first creating an Abstract Syntax Tree and then using the -pretty printer to convert it to PHP code. To simplify code generation, the project comes with a set of builders for -common structures as well as simple templating support. Both features are described in the following: - -Builders --------- - -The project provides builders for classes, interfaces, methods, functions, parameters and properties, which -allow creating node trees with a fluid interface, instead of instantiating all nodes manually. - -Here is an example: - -```php -<?php -$factory = new PHPParser_BuilderFactory; -$node = $factory->class('SomeClass') - ->extend('SomeOtherClass') - ->implement('A\Few', 'Interfaces') - ->makeAbstract() // ->makeFinal() - - ->addStmt($factory->method('someMethod') - ->makeAbstract() // ->makeFinal() - ->addParam($factory->param('someParam')->setTypeHint('SomeClass')) - ) - - ->addStmt($factory->method('anotherMethod') - ->makeProtected() // ->makePublic() [default], ->makePrivate() - ->addParam($factory->param('someParam')->setDefault('test')) - // it is possible to add manually created nodes - ->addStmt(new PHPParser_Node_Expr_Print(new PHPParser_Node_Expr_Variable('someParam'))) - ) - - // properties will be correctly reordered above the methods - ->addStmt($factory->property('someProperty')->makeProtected()) - ->addStmt($factory->property('anotherProperty')->makePrivate()->setDefault(array(1, 2, 3))) - - ->getNode() -; - -$stmts = array($node); -echo $prettyPrinter->prettyPrint($stmts); -``` - -This will produce the following output with the default pretty printer: - -```php -<?php -abstract class SomeClass extends SomeOtherClass implements A\Few, Interfaces -{ - protected $someProperty; - private $anotherProperty = array(1, 2, 3); - abstract function someMethod(SomeClass $someParam); - protected function anotherMethod($someParam = 'test') - { - print $someParam; - } -} -``` - -Templates ---------- - -> **DEPRECATED**: This feature is deprecated and will be removed in PHP-Parser 1.0. - -Additionally it is possible to generate code from reusable templates. - -As an example consider the following template, which defines a general getter/setter skeleton in terms of a property -`__name__` and its `__type__`: - -```php -<?php - -class GetterSetterTemplate -{ - /** - * @var __type__ The __name__ - */ - protected $__name__; - - /** - * Gets the __name__. - * - * @return __type__ The __name__ - */ - public function get__Name__() { - return $this->__name__; - } - - /** - * Sets the __name__. - * - * @param __type__ $__name__ The new __name__ - */ - public function set__Name__($__name__) { - $this->__name__ = $__name__; - } -} -``` - -Using this template we can easily create a class with multiple properties and their respective getters and setters: - -```php -<?php - -// $templateString contains the above template -$template = new PHPParser_Template($parser, $templateString); - -// We only have to specify the __name__ placeholder, as the -// capitalized __Name__ placeholder is automatically created -$properties = [ - ['name' => 'title', 'type' => 'string'], - ['name' => 'body', 'type' => 'string'], - ['name' => 'author', 'type' => 'User'], - ['name' => 'timestamp', 'type' => 'DateTime'], -]; - -$class = $factory->class('BlogPost')->implement('Post'); - -foreach ($properties as $propertyPlaceholders) { - $stmts = $template->getStmts($propertyPlaceholders); - - $class->addStmts( - // $stmts contains all statements from the template. So [0] fetches the class statement - // and ->stmts retrieves the methods. - $stmts[0]->stmts - ); -} - -echo $prettyPrinter->prettyPrint(array($class->getNode())); -``` - -The result would look roughly like this: - -```php -<?php - -class BlogPost implements Post -{ - /** - * @var string The title - */ - protected $title; - - /** - * @var string The body - */ - protected $body; - - /** - * @var User The author - */ - protected $author; - - /** - * @var DateTime The timestamp - */ - protected $timestamp; - - /** - * Gets the title. - * - * @return string The title - */ - public function getTitle() - { - return $this->title; - } - - /** - * Sets the title. - * - * @param string $title The new title - */ - public function setTitle($title) - { - $this->title = $title; - } - - /** - * Gets the body. - * - * @return string The body - */ - public function getBody() - { - return $this->body; - } - - /** - * Sets the body. - * - * @param string $body The new body - */ - public function setBody($body) - { - $this->body = $body; - } - - /** - * Gets the author. - * - * @return User The author - */ - public function getAuthor() - { - return $this->author; - } - - /** - * Sets the author. - * - * @param User $author The new author - */ - public function setAuthor($author) - { - $this->author = $author; - } - - /** - * Gets the timestamp. - * - * @return DateTime The timestamp - */ - public function getTimestamp() - { - return $this->timestamp; - } - - /** - * Sets the timestamp. - * - * @param DateTime $timestamp The new timestamp - */ - public function setTimestamp($timestamp) - { - $this->timestamp = $timestamp; - } -} -``` - -When using multiple templates it is easier to manage them on the filesystem. They can be loaded using the -`TemplateLoader`: - -```php -<?php - -// We'll store our templates in ./templates and give them a .php suffix -$loader = new PHPParser_TemplateLoader($parser, './templates', '.php'); - -// loads ./templates/GetterSetter.php -$getterSetterTemplate = $loader->load('GetterSetter'); - -// loads ./templates/Collection.php -$collectionTemplate = $loader->load('Collection'); - -// The use of a suffix is optional. The following code for example is equivalent: -$loader = new PHPParser_TemplateLoader($parser, './templates'); - -// loads ./templates/GetterSetter.php -$getterSetterTemplate = $loader->load('GetterSetter.php'); - -// loads ./templates/Collection.php -$collectionTemplate = $loader->load('Collection.php'); -``` \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/nikic/php-parser/doc/component/Lexer.markdown ---------------------------------------------------------------------- diff --git a/vendor/nikic/php-parser/doc/component/Lexer.markdown b/vendor/nikic/php-parser/doc/component/Lexer.markdown deleted file mode 100644 index cfdea4b..0000000 --- a/vendor/nikic/php-parser/doc/component/Lexer.markdown +++ /dev/null @@ -1,114 +0,0 @@ -Lexer component documentation -============================= - -The lexer is responsible for providing tokens to the parser. The project comes with two lexers: `PHPParser_Lexer` and -`PHPParser_Lexer_Emulative`. The latter is an extension of the former, which adds the ability to emulate tokens of -newer PHP versions and thus allows parsing of new code on older versions. - -A lexer has to define the following public interface: - - startLexing($code); - getNextToken(&$value = null, &$startAttributes = null, &$endAttributes = null); - handleHaltCompiler(); - -startLexing ------------ - -The `startLexing` method is invoked when the `parse()` method of the parser is called. It's argument will be whatever -was passed to the `parse()` method. - -Even though `startLexing` is meant to accept a source code string, you could for example overwrite it to accept a file: - -```php -<?php - -class FileLexer extends PHPParser_Lexer { - public function startLexing($fileName) { - if (!file_exists($fileName)) { - throw new InvalidArgumentException(sprintf('File "%s" does not exist', $fileName)); - } - - parent::startLexing(file_get_contents($fileName)); - } -} - -$parser = new PHPParser_Parser(new FileLexer); - -var_dump($parser->parse('someFile.php')); -var_dump($parser->parse('someOtherFile.php')); -``` - -getNextToken ------------- - -`getNextToken` returns the ID of the next token and sets some additional information in the three variables which it -accepts by-ref. If no more tokens are available it has to return `0`, which is the ID of the `EOF` token. - -The first by-ref variable `$value` should contain the textual content of the token. It is what will be available as `$1` -etc in the parser. - -The other two by-ref variables `$startAttributes` and `$endAttributes` define which attributes will eventually be -assigned to the generated nodes: The parser will take the `$startAttributes` from the first token which is part of the -node and the `$endAttributes` from the last token that is part of the node. - -E.g. if the tokens `T_FUNCTION T_STRING ... '{' ... '}'` constitute a node, then the `$startAttributes` from the -`T_FUNCTION` token will be taken and the `$endAttributes` from the `'}'` token. - -By default the lexer creates the attributes `startLine`, `comments` (both part of `$startAttributes`) and `endLine` -(part of `$endAttributes`). - -If you don't want all these attributes to be added (to reduce memory usage of the AST) you can simply remove them by -overriding the method: - -```php -<?php - -class LessAttributesLexer extends PHPParser_Lexer { - public function getNextToken(&$value = null, &$startAttributes = null, &$endAttributes = null) { - $tokenId = parent::getNextToken($value, $startAttributes, $endAttributes); - - // only keep startLine attribute - unset($startAttributes['comments']); - unset($endAttributes['endLine']); - - return $tokenId; - } -} -``` - -You can obviously also add additional attributes. E.g. in conjunction with the above `FileLexer` you might want to add -a `fileName` attribute to all nodes: - -```php -<?php - -class FileLexer extends PHPParser_Lexer { - protected $fileName; - - public function startLexing($fileName) { - if (!file_exists($fileName)) { - throw new InvalidArgumentException(sprintf('File "%s" does not exist', $fileName)); - } - - $this->fileName = $fileName; - parent::startLexing(file_get_contents($fileName)); - } - - public function getNextToken(&$value = null, &$startAttributes = null, &$endAttributes = null) { - $tokenId = parent::getNextToken($value, $startAttributes, $endAttributes); - - // we could use either $startAttributes or $endAttributes here, because the fileName is always the same - // (regardless of whether it is the start or end token). We choose $endAttributes, because it is slightly - // more efficient (as the parser has to keep a stack for the $startAttributes). - $endAttributes['fileName'] = $fileName; - - return $tokenId; - } -} -``` - -handleHaltCompiler ------------------- - -The method is invoked whenever a `T_HALT_COMPILER` token is encountered. It has to return the remaining string after the -construct (not including `();`). \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/nikic/php-parser/grammar/README.md ---------------------------------------------------------------------- diff --git a/vendor/nikic/php-parser/grammar/README.md b/vendor/nikic/php-parser/grammar/README.md deleted file mode 100644 index b39b13f..0000000 --- a/vendor/nikic/php-parser/grammar/README.md +++ /dev/null @@ -1,29 +0,0 @@ -What do all those files mean? -============================= - - * `zend_language_parser.phpy`: PHP grammer written in a pseudo language - * `analyze.php`: Analyzes the `.phpy`-grammer and outputs some info about it - * `rebuildParser.php`: Preprocesses the `.phpy`-grammar and builds the parser using `kmyacc` - * `kmyacc.php.parser`: A `kmyacc` parser prototype file for PHP - -.phpy pseudo language -===================== - -The `.phpy` file is a normal grammer in `kmyacc` (`yacc`) style, with some transformations -applied to it: - - * Nodes are created using the syntax `Name[..., ...]`. This is transformed into - `new PHPParser_Node_Name(..., ..., $attributes)` - * `Name::abc` is transformed to `PHPParser_Node_Name::abc` - * Some function-like constructs are resolved (see `rebuildParser.php` for a list) - * Associative arrays are written as `[key: value, ...]`, which is transformed to - `array('key' => value, ...)` - -Building the parser -=================== - -In order to rebuild the parser, you need [moriyoshi's fork of kmyacc](https://github.com/moriyoshi/kmyacc-forked). -After you compiled/installed it, run the `rebuildParser.php` script. - -By default only the `Parser.php` is built. If you want to additionally build `Parser/Debug.php` and `y.output` run the -script with `--debug`. If you want to retain the preprocessed grammar pass `--keep-tmp-grammar`. \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/nikic/php-parser/grammar/analyze.php ---------------------------------------------------------------------- diff --git a/vendor/nikic/php-parser/grammar/analyze.php b/vendor/nikic/php-parser/grammar/analyze.php deleted file mode 100644 index 50101df..0000000 --- a/vendor/nikic/php-parser/grammar/analyze.php +++ /dev/null @@ -1,96 +0,0 @@ -<?php - -const GRAMMAR_FILE = './zend_language_parser.phpy'; - -const LIB = '(?(DEFINE) - (?<singleQuotedString>\'[^\\\\\']*+(?:\\\\.[^\\\\\']*+)*+\') - (?<doubleQuotedString>"[^\\\\"]*+(?:\\\\.[^\\\\"]*+)*+") - (?<string>(?&singleQuotedString)|(?&doubleQuotedString)) - (?<comment>/\*[^*]*+(?:\*(?!/)[^*]*+)*+\*/) - (?<code>\{[^\'"/{}]*+(?:(?:(?&string)|(?&comment)|(?&code)|/)[^\'"/{}]*+)*+}) -)'; - -const RULE_BLOCK = '(?<name>[a-z_]++):(?<rules>[^\'"/{};]*+(?:(?:(?&string)|(?&comment)|(?&code)|/|})[^\'"/{};]*+)*+);'; - -$usedTerminals = array_flip(array( - 'T_VARIABLE', 'T_STRING', 'T_INLINE_HTML', 'T_ENCAPSED_AND_WHITESPACE', - 'T_LNUMBER', 'T_DNUMBER', 'T_CONSTANT_ENCAPSED_STRING', 'T_STRING_VARNAME', 'T_NUM_STRING' -)); -$unusedNonterminals = array_flip(array( - 'case_separator', 'optional_comma' -)); - -function regex($regex) { - return '~' . LIB . '(?:' . str_replace('~', '\~', $regex) . ')~'; -} - -function magicSplit($regex, $string) { - $pieces = preg_split(regex('(?:(?&string)|(?&comment)|(?&code))(*SKIP)(*FAIL)|' . $regex), $string); - - foreach ($pieces as &$piece) { - $piece = trim($piece); - } - - return array_filter($pieces); -} - -echo '<pre>'; - -//////////////////// -//////////////////// -//////////////////// - -list($defs, $ruleBlocks) = magicSplit('%%', file_get_contents(GRAMMAR_FILE)); - -if ('' !== trim(preg_replace(regex(RULE_BLOCK), '', $ruleBlocks))) { - die('Not all rule blocks were properly recognized!'); -} - -preg_match_all(regex(RULE_BLOCK), $ruleBlocks, $ruleBlocksMatches, PREG_SET_ORDER); -foreach ($ruleBlocksMatches as $match) { - $ruleBlockName = $match['name']; - $rules = magicSplit('\|', $match['rules']); - - foreach ($rules as &$rule) { - $parts = magicSplit('\s+', $rule); - $usedParts = array(); - - foreach ($parts as $part) { - if ('{' === $part[0]) { - preg_match_all('~\$([0-9]+)~', $part, $backReferencesMatches, PREG_SET_ORDER); - foreach ($backReferencesMatches as $match) { - $usedParts[$match[1]] = true; - } - } - } - - $i = 1; - foreach ($parts as &$part) { - if ('/' === $part[0]) { - continue; - } - - if (isset($usedParts[$i])) { - if ('\'' === $part[0] || '{' === $part[0] - || (ctype_upper($part[0]) && !isset($usedTerminals[$part])) - || (ctype_lower($part[0]) && isset($unusedNonterminals[$part])) - ) { - $part = '<span style="background-color: red; color: white;">' . $part . '</span>'; - } else { - $part = '<strong><em>' . $part . '</em></strong>'; - } - } elseif ((ctype_upper($part[0]) && isset($usedTerminals[$part])) - || (ctype_lower($part[0]) && !isset($unusedNonterminals[$part])) - - ) { - $part = '<span style="background-color: blue; color: white;">' . $part . '</span>'; - } - - ++$i; - } - - $rule = implode(' ', $parts); - } - - echo $ruleBlockName, ':', "\n", ' ', implode("\n" . ' | ', $rules), "\n", ';', "\n\n"; -} \ No newline at end of file
