Browse Source

Merge pull request #1275 from hamiltont/fix-php-lithium

PHP: Replace lithium and phreeze source code with composer download
Hamilton Turner 11 năm trước cách đây
mục cha
commit
e737a5aa40
100 tập tin đã thay đổi với 103 bổ sung4956 xóa
  1. 1 1
      .travis.yml
  2. 2 0
      frameworks/PHP/lithium/.gitignore
  3. 0 0
      frameworks/PHP/lithium/.gitmodules
  4. 0 0
      frameworks/PHP/lithium/.htaccess
  5. 0 0
      frameworks/PHP/lithium/README.md
  6. 0 0
      frameworks/PHP/lithium/__init__.py
  7. 0 0
      frameworks/PHP/lithium/app/.htaccess
  8. 0 0
      frameworks/PHP/lithium/app/config/bootstrap.php
  9. 0 0
      frameworks/PHP/lithium/app/config/bootstrap/action.php
  10. 0 0
      frameworks/PHP/lithium/app/config/bootstrap/cache.php
  11. 0 0
      frameworks/PHP/lithium/app/config/bootstrap/connections.php
  12. 0 0
      frameworks/PHP/lithium/app/config/bootstrap/console.php
  13. 0 0
      frameworks/PHP/lithium/app/config/bootstrap/errors.php
  14. 0 0
      frameworks/PHP/lithium/app/config/bootstrap/g11n.php
  15. 1 1
      frameworks/PHP/lithium/app/config/bootstrap/libraries.php
  16. 0 0
      frameworks/PHP/lithium/app/config/bootstrap/media.php
  17. 0 0
      frameworks/PHP/lithium/app/config/bootstrap/session.php
  18. 0 0
      frameworks/PHP/lithium/app/config/routes.php
  19. 0 0
      frameworks/PHP/lithium/app/controllers/BenchController.php
  20. 0 0
      frameworks/PHP/lithium/app/controllers/HelloWorldController.php
  21. 0 0
      frameworks/PHP/lithium/app/controllers/PagesController.php
  22. 0 0
      frameworks/PHP/lithium/app/extensions/adapter/empty
  23. 0 0
      frameworks/PHP/lithium/app/extensions/command/empty
  24. 0 0
      frameworks/PHP/lithium/app/extensions/data/source/empty
  25. 0 0
      frameworks/PHP/lithium/app/extensions/helper/empty
  26. 0 0
      frameworks/PHP/lithium/app/index.php
  27. 0 0
      frameworks/PHP/lithium/app/libraries/_source/empty
  28. 0 0
      frameworks/PHP/lithium/app/models/World.php
  29. 0 0
      frameworks/PHP/lithium/app/models/empty
  30. 0 0
      frameworks/PHP/lithium/app/resources/g11n/empty
  31. 0 0
      frameworks/PHP/lithium/app/resources/tmp/cache/templates/empty
  32. 0 0
      frameworks/PHP/lithium/app/resources/tmp/cache/templates/template_views_layouts_default.html_0_1365705000_831.php
  33. 0 0
      frameworks/PHP/lithium/app/resources/tmp/cache/templates/template_views_pages_home.html_0_1365705000_8876.php
  34. 0 0
      frameworks/PHP/lithium/app/resources/tmp/logs/empty
  35. 0 0
      frameworks/PHP/lithium/app/resources/tmp/tests/empty
  36. 0 0
      frameworks/PHP/lithium/app/tests/cases/controllers/empty
  37. 0 0
      frameworks/PHP/lithium/app/tests/cases/extensions/adapter/empty
  38. 0 0
      frameworks/PHP/lithium/app/tests/cases/extensions/command/empty
  39. 0 0
      frameworks/PHP/lithium/app/tests/cases/extensions/data/source/empty
  40. 0 0
      frameworks/PHP/lithium/app/tests/cases/extensions/helper/empty
  41. 0 0
      frameworks/PHP/lithium/app/tests/cases/models/empty
  42. 0 0
      frameworks/PHP/lithium/app/tests/functional/empty
  43. 0 0
      frameworks/PHP/lithium/app/tests/integration/empty
  44. 0 0
      frameworks/PHP/lithium/app/tests/mocks/empty
  45. 0 0
      frameworks/PHP/lithium/app/views/_errors/development.html.php
  46. 0 0
      frameworks/PHP/lithium/app/views/elements/empty
  47. 0 0
      frameworks/PHP/lithium/app/views/hello_world/index.html.php
  48. 0 0
      frameworks/PHP/lithium/app/views/layouts/default.html.php
  49. 0 0
      frameworks/PHP/lithium/app/views/layouts/default.xml.php
  50. 0 0
      frameworks/PHP/lithium/app/views/layouts/error.html.php
  51. 0 0
      frameworks/PHP/lithium/app/views/pages/home.html.php
  52. 0 0
      frameworks/PHP/lithium/app/web.config
  53. 0 0
      frameworks/PHP/lithium/app/webroot/.htaccess
  54. 0 0
      frameworks/PHP/lithium/app/webroot/css/debug.css
  55. 0 0
      frameworks/PHP/lithium/app/webroot/css/lithium.css
  56. 0 0
      frameworks/PHP/lithium/app/webroot/favicon.ico
  57. 0 0
      frameworks/PHP/lithium/app/webroot/img/empty
  58. 0 0
      frameworks/PHP/lithium/app/webroot/index.php
  59. 0 0
      frameworks/PHP/lithium/app/webroot/js/empty
  60. 0 0
      frameworks/PHP/lithium/app/webroot/web.config
  61. 0 0
      frameworks/PHP/lithium/benchmark_config
  62. 7 0
      frameworks/PHP/lithium/composer.json
  63. 71 0
      frameworks/PHP/lithium/composer.lock
  64. 0 0
      frameworks/PHP/lithium/deploy/nginx.conf
  65. 0 0
      frameworks/PHP/lithium/deploy/php-lithium
  66. 0 0
      frameworks/PHP/lithium/index.php
  67. 14 0
      frameworks/PHP/lithium/install.sh
  68. 7 0
      frameworks/PHP/lithium/setup.sh
  69. 0 0
      frameworks/PHP/lithium/source_code
  70. 0 0
      frameworks/PHP/lithium/web.config
  71. 0 8
      frameworks/PHP/php-lithium/bash_profile.sh
  72. 0 3
      frameworks/PHP/php-lithium/install.sh
  73. 0 5
      frameworks/PHP/php-lithium/libraries/lithium/.gitignore
  74. 0 20
      frameworks/PHP/php-lithium/libraries/lithium/.travis.yml
  75. 0 12
      frameworks/PHP/php-lithium/libraries/lithium/CONTRIBUTING.md
  76. 0 25
      frameworks/PHP/php-lithium/libraries/lithium/LICENSE.txt
  77. 0 313
      frameworks/PHP/php-lithium/libraries/lithium/action/Controller.php
  78. 0 21
      frameworks/PHP/php-lithium/libraries/lithium/action/DispatchException.php
  79. 0 269
      frameworks/PHP/php-lithium/libraries/lithium/action/Dispatcher.php
  80. 0 640
      frameworks/PHP/php-lithium/libraries/lithium/action/Request.php
  81. 0 175
      frameworks/PHP/php-lithium/libraries/lithium/action/Response.php
  82. 0 1
      frameworks/PHP/php-lithium/libraries/lithium/action/readme.md
  83. 0 205
      frameworks/PHP/php-lithium/libraries/lithium/analysis/Debugger.php
  84. 0 122
      frameworks/PHP/php-lithium/libraries/lithium/analysis/Docblock.php
  85. 0 590
      frameworks/PHP/php-lithium/libraries/lithium/analysis/Inspector.php
  86. 0 196
      frameworks/PHP/php-lithium/libraries/lithium/analysis/Logger.php
  87. 0 315
      frameworks/PHP/php-lithium/libraries/lithium/analysis/Parser.php
  88. 0 81
      frameworks/PHP/php-lithium/libraries/lithium/analysis/logger/adapter/Cache.php
  89. 0 83
      frameworks/PHP/php-lithium/libraries/lithium/analysis/logger/adapter/File.php
  90. 0 194
      frameworks/PHP/php-lithium/libraries/lithium/analysis/logger/adapter/FirePhp.php
  91. 0 247
      frameworks/PHP/php-lithium/libraries/lithium/analysis/logger/adapter/Growl.php
  92. 0 86
      frameworks/PHP/php-lithium/libraries/lithium/analysis/logger/adapter/Syslog.php
  93. 0 22
      frameworks/PHP/php-lithium/libraries/lithium/composer.json
  94. 0 423
      frameworks/PHP/php-lithium/libraries/lithium/console/Command.php
  95. 0 202
      frameworks/PHP/php-lithium/libraries/lithium/console/Dispatcher.php
  96. 0 203
      frameworks/PHP/php-lithium/libraries/lithium/console/Request.php
  97. 0 142
      frameworks/PHP/php-lithium/libraries/lithium/console/Response.php
  98. 0 55
      frameworks/PHP/php-lithium/libraries/lithium/console/Router.php
  99. 0 260
      frameworks/PHP/php-lithium/libraries/lithium/console/command/Create.php
  100. 0 36
      frameworks/PHP/php-lithium/libraries/lithium/console/command/G11n.php

+ 1 - 1
.travis.yml

@@ -106,7 +106,7 @@ env:
     - "TESTDIR=PHP/php-fuel"
     - "TESTDIR=PHP/php-kohana"
     - "TESTDIR=PHP/php-laravel"
-    - "TESTDIR=PHP/php-lithium"
+    - "TESTDIR=PHP/lithium"
     - "TESTDIR=PHP/php-micromvc"
     - "TESTDIR=PHP/php-phalcon"
     - "TESTDIR=PHP/php-phalcon-micro"

+ 2 - 0
frameworks/PHP/php-lithium/.gitignore → frameworks/PHP/lithium/.gitignore

@@ -7,3 +7,5 @@
 .DS_Store
 /tags
 .idea
+vendor
+deploy/php-fpm.pid

+ 0 - 0
frameworks/PHP/php-lithium/.gitmodules → frameworks/PHP/lithium/.gitmodules


+ 0 - 0
frameworks/PHP/php-lithium/.htaccess → frameworks/PHP/lithium/.htaccess


+ 0 - 0
frameworks/PHP/php-lithium/README.md → frameworks/PHP/lithium/README.md


+ 0 - 0
frameworks/PHP/php-lithium/__init__.py → frameworks/PHP/lithium/__init__.py


+ 0 - 0
frameworks/PHP/php-lithium/app/.htaccess → frameworks/PHP/lithium/app/.htaccess


+ 0 - 0
frameworks/PHP/php-lithium/app/config/bootstrap.php → frameworks/PHP/lithium/app/config/bootstrap.php


+ 0 - 0
frameworks/PHP/php-lithium/app/config/bootstrap/action.php → frameworks/PHP/lithium/app/config/bootstrap/action.php


+ 0 - 0
frameworks/PHP/php-lithium/app/config/bootstrap/cache.php → frameworks/PHP/lithium/app/config/bootstrap/cache.php


+ 0 - 0
frameworks/PHP/php-lithium/app/config/bootstrap/connections.php → frameworks/PHP/lithium/app/config/bootstrap/connections.php


+ 0 - 0
frameworks/PHP/php-lithium/app/config/bootstrap/console.php → frameworks/PHP/lithium/app/config/bootstrap/console.php


+ 0 - 0
frameworks/PHP/php-lithium/app/config/bootstrap/errors.php → frameworks/PHP/lithium/app/config/bootstrap/errors.php


+ 0 - 0
frameworks/PHP/php-lithium/app/config/bootstrap/g11n.php → frameworks/PHP/lithium/app/config/bootstrap/g11n.php


+ 1 - 1
frameworks/PHP/php-lithium/app/config/bootstrap/libraries.php → frameworks/PHP/lithium/app/config/bootstrap/libraries.php

@@ -59,7 +59,7 @@ define('LITHIUM_APP_PATH', dirname(dirname(__DIR__)));
  * directory as your application.  If you use the same libraries in multiple applications, you can
  * set this to a shared path on your server.
  */
-define('LITHIUM_LIBRARY_PATH', dirname(LITHIUM_APP_PATH) . '/libraries');
+define('LITHIUM_LIBRARY_PATH', dirname(LITHIUM_APP_PATH) . '/vendor/unionofrad/lithium');
 
 /**
  * Locate and load Lithium core library files.  Throws a fatal error if the core can't be found.

+ 0 - 0
frameworks/PHP/php-lithium/app/config/bootstrap/media.php → frameworks/PHP/lithium/app/config/bootstrap/media.php


+ 0 - 0
frameworks/PHP/php-lithium/app/config/bootstrap/session.php → frameworks/PHP/lithium/app/config/bootstrap/session.php


+ 0 - 0
frameworks/PHP/php-lithium/app/config/routes.php → frameworks/PHP/lithium/app/config/routes.php


+ 0 - 0
frameworks/PHP/php-lithium/app/controllers/BenchController.php → frameworks/PHP/lithium/app/controllers/BenchController.php


+ 0 - 0
frameworks/PHP/php-lithium/app/controllers/HelloWorldController.php → frameworks/PHP/lithium/app/controllers/HelloWorldController.php


+ 0 - 0
frameworks/PHP/php-lithium/app/controllers/PagesController.php → frameworks/PHP/lithium/app/controllers/PagesController.php


+ 0 - 0
frameworks/PHP/php-lithium/app/extensions/adapter/empty → frameworks/PHP/lithium/app/extensions/adapter/empty


+ 0 - 0
frameworks/PHP/php-lithium/app/extensions/command/empty → frameworks/PHP/lithium/app/extensions/command/empty


+ 0 - 0
frameworks/PHP/php-lithium/app/extensions/data/source/empty → frameworks/PHP/lithium/app/extensions/data/source/empty


+ 0 - 0
frameworks/PHP/php-lithium/app/extensions/helper/empty → frameworks/PHP/lithium/app/extensions/helper/empty


+ 0 - 0
frameworks/PHP/php-lithium/app/index.php → frameworks/PHP/lithium/app/index.php


+ 0 - 0
frameworks/PHP/php-lithium/app/libraries/_source/empty → frameworks/PHP/lithium/app/libraries/_source/empty


+ 0 - 0
frameworks/PHP/php-lithium/app/models/World.php → frameworks/PHP/lithium/app/models/World.php


+ 0 - 0
frameworks/PHP/php-lithium/app/models/empty → frameworks/PHP/lithium/app/models/empty


+ 0 - 0
frameworks/PHP/php-lithium/app/resources/g11n/empty → frameworks/PHP/lithium/app/resources/g11n/empty


+ 0 - 0
frameworks/PHP/php-lithium/app/resources/tmp/cache/templates/empty → frameworks/PHP/lithium/app/resources/tmp/cache/templates/empty


+ 0 - 0
frameworks/PHP/php-lithium/app/resources/tmp/cache/templates/template_views_layouts_default.html_0_1365705000_831.php → frameworks/PHP/lithium/app/resources/tmp/cache/templates/template_views_layouts_default.html_0_1365705000_831.php


+ 0 - 0
frameworks/PHP/php-lithium/app/resources/tmp/cache/templates/template_views_pages_home.html_0_1365705000_8876.php → frameworks/PHP/lithium/app/resources/tmp/cache/templates/template_views_pages_home.html_0_1365705000_8876.php


+ 0 - 0
frameworks/PHP/php-lithium/app/resources/tmp/logs/empty → frameworks/PHP/lithium/app/resources/tmp/logs/empty


+ 0 - 0
frameworks/PHP/php-lithium/app/resources/tmp/tests/empty → frameworks/PHP/lithium/app/resources/tmp/tests/empty


+ 0 - 0
frameworks/PHP/php-lithium/app/tests/cases/controllers/empty → frameworks/PHP/lithium/app/tests/cases/controllers/empty


+ 0 - 0
frameworks/PHP/php-lithium/app/tests/cases/extensions/adapter/empty → frameworks/PHP/lithium/app/tests/cases/extensions/adapter/empty


+ 0 - 0
frameworks/PHP/php-lithium/app/tests/cases/extensions/command/empty → frameworks/PHP/lithium/app/tests/cases/extensions/command/empty


+ 0 - 0
frameworks/PHP/php-lithium/app/tests/cases/extensions/data/source/empty → frameworks/PHP/lithium/app/tests/cases/extensions/data/source/empty


+ 0 - 0
frameworks/PHP/php-lithium/app/tests/cases/extensions/helper/empty → frameworks/PHP/lithium/app/tests/cases/extensions/helper/empty


+ 0 - 0
frameworks/PHP/php-lithium/app/tests/cases/models/empty → frameworks/PHP/lithium/app/tests/cases/models/empty


+ 0 - 0
frameworks/PHP/php-lithium/app/tests/functional/empty → frameworks/PHP/lithium/app/tests/functional/empty


+ 0 - 0
frameworks/PHP/php-lithium/app/tests/integration/empty → frameworks/PHP/lithium/app/tests/integration/empty


+ 0 - 0
frameworks/PHP/php-lithium/app/tests/mocks/empty → frameworks/PHP/lithium/app/tests/mocks/empty


+ 0 - 0
frameworks/PHP/php-lithium/app/views/_errors/development.html.php → frameworks/PHP/lithium/app/views/_errors/development.html.php


+ 0 - 0
frameworks/PHP/php-lithium/app/views/elements/empty → frameworks/PHP/lithium/app/views/elements/empty


+ 0 - 0
frameworks/PHP/php-lithium/app/views/hello_world/index.html.php → frameworks/PHP/lithium/app/views/hello_world/index.html.php


+ 0 - 0
frameworks/PHP/php-lithium/app/views/layouts/default.html.php → frameworks/PHP/lithium/app/views/layouts/default.html.php


+ 0 - 0
frameworks/PHP/php-lithium/app/views/layouts/default.xml.php → frameworks/PHP/lithium/app/views/layouts/default.xml.php


+ 0 - 0
frameworks/PHP/php-lithium/app/views/layouts/error.html.php → frameworks/PHP/lithium/app/views/layouts/error.html.php


+ 0 - 0
frameworks/PHP/php-lithium/app/views/pages/home.html.php → frameworks/PHP/lithium/app/views/pages/home.html.php


+ 0 - 0
frameworks/PHP/php-lithium/app/web.config → frameworks/PHP/lithium/app/web.config


+ 0 - 0
frameworks/PHP/php-lithium/app/webroot/.htaccess → frameworks/PHP/lithium/app/webroot/.htaccess


+ 0 - 0
frameworks/PHP/php-lithium/app/webroot/css/debug.css → frameworks/PHP/lithium/app/webroot/css/debug.css


+ 0 - 0
frameworks/PHP/php-lithium/app/webroot/css/lithium.css → frameworks/PHP/lithium/app/webroot/css/lithium.css


+ 0 - 0
frameworks/PHP/php-lithium/app/webroot/favicon.ico → frameworks/PHP/lithium/app/webroot/favicon.ico


+ 0 - 0
frameworks/PHP/php-lithium/app/webroot/img/empty → frameworks/PHP/lithium/app/webroot/img/empty


+ 0 - 0
frameworks/PHP/php-lithium/app/webroot/index.php → frameworks/PHP/lithium/app/webroot/index.php


+ 0 - 0
frameworks/PHP/php-lithium/app/webroot/js/empty → frameworks/PHP/lithium/app/webroot/js/empty


+ 0 - 0
frameworks/PHP/php-lithium/app/webroot/web.config → frameworks/PHP/lithium/app/webroot/web.config


+ 0 - 0
frameworks/PHP/php-lithium/benchmark_config → frameworks/PHP/lithium/benchmark_config


+ 7 - 0
frameworks/PHP/lithium/composer.json

@@ -0,0 +1,7 @@
+{
+    "require": {
+        "php": ">=5.3.0",
+        "unionofrad/lithium": "dev-master"
+    }
+}
+

+ 71 - 0
frameworks/PHP/lithium/composer.lock

@@ -0,0 +1,71 @@
+{
+    "_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": "cca4d6bbcfee431c6347433af401c186",
+    "packages": [
+        {
+            "name": "unionofrad/lithium",
+            "version": "dev-master",
+            "target-dir": "lithium",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/UnionOfRAD/lithium.git",
+                "reference": "791c2ce345b63cd47f067cdebccb6497a35de014"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/UnionOfRAD/lithium/zipball/791c2ce345b63cd47f067cdebccb6497a35de014",
+                "reference": "791c2ce345b63cd47f067cdebccb6497a35de014",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.6"
+            },
+            "bin": [
+                "console/li3"
+            ],
+            "type": "library",
+            "autoload": {
+                "psr-0": {
+                    "lithium": ""
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "BSD-3-Clause"
+            ],
+            "authors": [
+                {
+                    "name": "Union of RAD",
+                    "homepage": "http://union-of-rad.org"
+                },
+                {
+                    "name": "The Lithium Community",
+                    "homepage": "http://github.com/UnionOfRAD/lithium/graphs/contributors"
+                }
+            ],
+            "description": "The core library of the Lithium PHP framework",
+            "homepage": "http://lithify.me",
+            "keywords": [
+                "framework",
+                "lithium"
+            ],
+            "time": "2014-01-04 19:49:26"
+        }
+    ],
+    "packages-dev": [],
+    "aliases": [],
+    "minimum-stability": "stable",
+    "stability-flags": {
+        "unionofrad/lithium": 20
+    },
+    "prefer-stable": false,
+    "prefer-lowest": false,
+    "platform": {
+        "php": ">=5.3.0"
+    },
+    "platform-dev": []
+}

+ 0 - 0
frameworks/PHP/php-lithium/deploy/nginx.conf → frameworks/PHP/lithium/deploy/nginx.conf


+ 0 - 0
frameworks/PHP/php-lithium/deploy/php-lithium → frameworks/PHP/lithium/deploy/php-lithium


+ 0 - 0
frameworks/PHP/php-lithium/index.php → frameworks/PHP/lithium/index.php


+ 14 - 0
frameworks/PHP/lithium/install.sh

@@ -0,0 +1,14 @@
+#!/bin/bash
+
+export PHP_HOME=${IROOT}/php-5.5.17
+
+export PHP_FPM=$PHP_HOME/sbin/php-fpm
+
+export NGINX_HOME=${IROOT}/nginx
+
+fw_depends php nginx composer
+
+${PHP_HOME}/bin/php $IROOT/composer.phar install \
+  --no-interaction --working-dir $TROOT \
+  --no-progress --optimize-autoloader 
+

+ 7 - 0
frameworks/PHP/php-lithium/setup.sh → frameworks/PHP/lithium/setup.sh

@@ -1,5 +1,12 @@
 #!/bin/bash
 
+export PHP_HOME=${IROOT}/php-5.5.17
+
+export PHP_FPM=$PHP_HOME/sbin/php-fpm
+
+export NGINX_HOME=${IROOT}/nginx
+
+
 sed -i 's|192.168.100.102|'"${DBHOST}"'|g' app/config/bootstrap/connections.php
 sed -i 's|root .*/FrameworkBenchmarks/php-lithium|root '"${TROOT}"'|g' deploy/nginx.conf
 sed -i 's|/usr/local/nginx/|'"${IROOT}"'/nginx/|g' deploy/nginx.conf

+ 0 - 0
frameworks/PHP/php-lithium/source_code → frameworks/PHP/lithium/source_code


+ 0 - 0
frameworks/PHP/php-lithium/web.config → frameworks/PHP/lithium/web.config


+ 0 - 8
frameworks/PHP/php-lithium/bash_profile.sh

@@ -1,8 +0,0 @@
-#!/bin/bash
-
-export PHP_HOME=${IROOT}/php-5.5.17
-
-export PHP_FPM=$PHP_HOME/sbin/php-fpm
-
-export NGINX_HOME=${IROOT}/nginx
-

+ 0 - 3
frameworks/PHP/php-lithium/install.sh

@@ -1,3 +0,0 @@
-#!/bin/bash
-
-fw_depends php nginx

+ 0 - 5
frameworks/PHP/php-lithium/libraries/lithium/.gitignore

@@ -1,5 +0,0 @@
-# OS X
-.DS_Store
-
-# Vim
-.*.sw[a-z]

+ 0 - 20
frameworks/PHP/php-lithium/libraries/lithium/.travis.yml

@@ -1,20 +0,0 @@
-language: php
-
-env:
-  - OPCODE_CACHE=apc
- #- OPCODE_CACHE=xcache
-
-php:
-  - 5.3
-  - 5.4
-
-before_script:
- - php tests/ci_depends.php $OPCODE_CACHE
-# - cd ../ && git clone git://github.com/UnionOfRAD/li3_quality.git && cd lithium
-
-script:
- - console/li3 test --filters=Profiler tests/cases
-# - console/li3 test --filters=Profiler tests/cases && cd ../li3_quality && for FILE in $(cd ../lithium/ && git diff-index --name-only --diff-filter=AM HEAD~1); do ../lithium/console/li3 quality syntax ../lithium/${FILE} --silent; done
-
-notifications:
-    irc: "irc.freenode.org#li3-core"

+ 0 - 12
frameworks/PHP/php-lithium/libraries/lithium/CONTRIBUTING.md

@@ -1,12 +0,0 @@
-# Contributing guidelines
-
-Thank you for your interest in contributing to Lithium! This project is built by a thriving community of developers who value cutting-edge technology and concise, maintainable code. If you've found a bug, or have an idea for a feature, we encourage your participation in making Lithium better.
-
-Here's what you need to stick to in order to have the best chance of getting your code pushed to the core:
-
- * **Integration**: all pull requests should be submitted against the [`dev`](https://github.com/UnionOfRAD/lithium/tree/dev) branch for integration testing
- * **Conceptual integrity**: code should conform to the goals of the framework
- * **Maintainability**: code should pass existing tests, have adequate test coverage and should conform to our coding standards & QA guidelines
- * **Comprehensibility**: code should be concise and expressive, and should be accompanied by new documentation as appropriate, or updates to existing docs
-
-Please see the full documentation over at the [contribution guidelines](http://lithify.me/docs/manual/appendices/contributing.wiki) at [lithify.me](http://lithify.me/)

+ 0 - 25
frameworks/PHP/php-lithium/libraries/lithium/LICENSE.txt

@@ -1,25 +0,0 @@
-Copyright (c) 2013, Union of RAD http://union-of-rad.org
-All 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.
-    * Neither the name of Lithium, Union of Rad, nor the names of its contributors 
-		may 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 HOLDER 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.

+ 0 - 313
frameworks/PHP/php-lithium/libraries/lithium/action/Controller.php

@@ -1,313 +0,0 @@
-<?php
-/**
- * Lithium: the most rad php framework
- *
- * @copyright     Copyright 2012, Union of RAD (http://union-of-rad.org)
- * @license       http://opensource.org/licenses/bsd-license.php The BSD License
- */
-
-namespace lithium\action;
-
-use lithium\util\Inflector;
-use lithium\action\DispatchException;
-use lithium\core\Libraries;
-
-/**
- * The `Controller` class is the fundamental building block of your application's request/response
- * cycle. Controllers are organized around a single logical entity, usually one or more model
- * classes (i.e. `lithium\data\Model`) and are tasked with performing operations against that
- * entity.
- *
- * Each controller has a series of 'actions' which are defined as class methods of the `Controller`
- * classes. Each action has a specific responsibility, such as listing a set of objects, updating an
- * object, or deleting an object.
- *
- * A controller object is instantiated by the `Dispatcher` (`lithium\action\Dispatcher`), and is
- * given an instance of the `lithium\action\Request` class, which contains all necessary request
- * state, including routing information, `GET` & `POST` data, and server variables. The controller
- * is then invoked (using PHP's magic `__invoke()` syntax), and the proper action is called,
- * according to the routing information stored in the `Request` object.
- *
- * A controller then returns a response (i.e. using `redirect()` or `render()`) which includes HTTP
- * headers, and/or a serialized data response (JSON or XML, etc.) or HTML webpage.
- *
- * For more information on returning serialized data responses for web services, or manipulating
- * template rendering from within your controllers, see the settings in `$_render` and the
- * `lithium\net\http\Media` class.
- *
- * @see lithium\net\http\Media
- * @see lithium\action\Dispatcher
- * @see lithium\action\Controller::$_render
- */
-class Controller extends \lithium\core\Object {
-
-	/**
-	 * Contains an instance of the `Request` object with all the details of the HTTP request that
-	 * was dispatched to the controller object. Any parameters captured in routing, such as
-	 * controller or action name are accessible as properties of this object, i.e.
-	 * `$this->request->controller` or `$this->request->action`.
-	 *
-	 * @see lithium\action\Request
-	 * @var object
-	 */
-	public $request = null;
-
-	/**
-	 * Contains an instance of the `Response` object which aggregates the headers and body content
-	 * to be written back to the client (browser) when the result of the request is rendered.
-	 *
-	 * @see lithium\action\Response
-	 * @var object
-	 */
-	public $response = null;
-
-	/**
-	 * Lists the rendering control options for responses generated by this controller.
-	 *
-	 * - The `'type'` key is the content type that will be rendered by default, unless another is
-	 *   explicitly specified (defaults to `'html'`).
-	 * - The `'data'` key contains an associative array of variables to be sent to the view,
-	 *   including any variables created in `set()`, or if an action returns any variables (as an
-	 *   associative array).
-	 * - When an action is invoked, it will by default attempt to render a response, set the
-	 *   `'auto'` key to `false` to prevent this behavior.
-	 * - If you manually call `render()` within an action, the `'hasRendered'` key stores this
-	 *   state, so that responses are not rendered multiple times, either manually or automatically.
-	 * - The `'layout'` key specifies the name of the layout to be used (defaults to `'default'`).
-	 *   Typically, layout files are looked up as
-	 *   `<app-path>/views/layouts/<layout-name>.<type>.php`. Based on the default settings, the
-	 *   actual path would be `path-to-app/views/layouts/default.html.php`.
-	 * - Though typically introspected from the action that is executed, the `'template'` key can be
-	 *   manually specified. This sets the template to be rendered, and is looked up (by default) as
-	 *   `<app-path>/views/<controller>/<action>.<type>.php`, i.e.:
-	 *   `path-to-app/views/posts/index.html.php`.
-	 * - To enable automatic content-type negotiation (i.e. determining the content type of the
-	 *   response based on the value of the
-	 *   [HTTP Accept header](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html)), set the
-	 *   `'negotiate'` flag to `true`. Otherwise, the response will only be based on the `type`
-	 *   parameter of the request object (defaulting to `'html'` if no type is present in the
-	 *   `Request` parameters).
-	 *
-	 * Keep in mind that most of these settings may be passed to `Controller::render()` as well. To
-	 * change how these settings operate (i.e. template paths, default render settings for
-	 * individual media types), see the `Media` class.
-	 *
-	 * @var array
-	 * @see lithium\action\Controller::render()
-	 * @see lithium\net\http\Media::type()
-	 * @see lithium\net\http\Media::render()
-	 */
-	protected $_render = array(
-		'type'        => null,
-		'data'        => array(),
-		'auto'        => true,
-		'layout'      => 'default',
-		'template'    => null,
-		'hasRendered' => false,
-		'negotiate'   => false
-	);
-
-	/**
-	 * Lists `Controller`'s class dependencies. For details on extending or replacing a class,
-	 * please refer to that class's API.
-	 *
-	 * @var array
-	 */
-	protected $_classes = array(
-		'media' => 'lithium\net\http\Media',
-		'router' => 'lithium\net\http\Router',
-		'response' => 'lithium\action\Response'
-	);
-
-	/**
-	 * Auto configuration properties.
-	 *
-	 * @var array
-	 */
-	protected $_autoConfig = array('render' => 'merge', 'classes' => 'merge');
-
-	public function __construct(array $config = array()) {
-		$defaults = array(
-			'request' => null, 'response' => array(), 'render' => array(), 'classes' => array()
-		);
-		parent::__construct($config + $defaults);
-	}
-
-	/**
-	 * Populates the `$response` property with a new instance of the `Response` class passing it
-	 * configuration, and sets some rendering options, depending on the incoming request.
-	 *
-	 * @return void
-	 */
-	protected function _init() {
-		parent::_init();
-		$this->request = $this->request ?: $this->_config['request'];
-		$this->response = $this->_instance('response', $this->_config['response']);
-
-		if (!$this->request || $this->_render['type']) {
-			return;
-		}
-		if ($this->_render['negotiate']) {
-			$this->_render['type'] = $this->request->accepts();
-			return;
-		}
-		$this->_render['type'] = $this->request->get('params:type') ?: 'html';
-	}
-
-	/**
-	 * Called by the Dispatcher class to invoke an action.
-	 *
-	 * @param object $request The request object with URL and HTTP info for dispatching this action.
-	 * @param array $dispatchParams The array of parameters that will be passed to the action.
-	 * @param array $options The dispatch options for this action.
-	 * @return object Returns the response object associated with this controller.
-	 * @filter This method can be filtered.
-	 */
-	public function __invoke($request, $dispatchParams, array $options = array()) {
-		$render =& $this->_render;
-		$params = compact('request', 'dispatchParams', 'options');
-
-		return $this->_filter(__METHOD__, $params, function($self, $params) use (&$render) {
-			$dispatchParams = $params['dispatchParams'];
-
-			$action = isset($dispatchParams['action']) ? $dispatchParams['action'] : 'index';
-			$args = isset($dispatchParams['args']) ? $dispatchParams['args'] : array();
-			$result = null;
-
-			if (substr($action, 0, 1) === '_' || method_exists(__CLASS__, $action)) {
-				throw new DispatchException('Attempted to invoke a private method.');
-			}
-			if (!method_exists($self, $action)) {
-				throw new DispatchException("Action `{$action}` not found.");
-			}
-			$render['template'] = $render['template'] ?: $action;
-
-			if ($result = $self->invokeMethod($action, $args)) {
-				if (is_string($result)) {
-					$self->render(array('text' => $result));
-					return $self->response;
-				}
-				if (is_array($result)) {
-					$self->set($result);
-				}
-			}
-
-			if (!$render['hasRendered'] && $render['auto']) {
-				$self->render();
-			}
-			return $self->response;
-		});
-	}
-
-	/**
-	 * This method is used to pass along any data from the controller to the view and layout
-	 *
-	 * @param array $data sets of `<variable name> => <variable value>` to pass to view layer.
-	 * @return void
-	 */
-	public function set($data = array()) {
-		$this->_render['data'] = (array) $data + $this->_render['data'];
-	}
-
-	/**
-	 * Uses results (typically coming from a controller action) to generate content and headers for
-	 * a `Response` object.
-	 *
-	 * @see lithium\action\Controller::$_render
-	 * @param array $options An array of options, as follows:
-	 *        - `'data'`: An associative array of variables to be assigned to the template. These
-	 *          are merged on top of any variables set in `Controller::set()`.
-	 *        - `'head'`: If true, only renders the headers of the response, not the body. Defaults
-	 *          to `false`.
-	 *        - `'template'`: The name of a template, which usually matches the name of the action.
-	 *          By default, this template is looked for in the views directory of the current
-	 *          controller, i.e. given a `PostsController` object, if template is set to `'view'`,
-	 *          the template path would be `views/posts/view.html.php`. Defaults to the name of the
-	 *          action being rendered.
-	 *
-	 * The options specified here are merged with the values in the `Controller::$_render`
-	 * property. You may refer to it for other options accepted by this method.
-	 * @return object Returns the `Response` object associated with this `Controller` instance.
-	 */
-	public function render(array $options = array()) {
-		$media = $this->_classes['media'];
-		$class = get_class($this);
-		$name = preg_replace('/Controller$/', '', substr($class, strrpos($class, '\\') + 1));
-		$key = key($options);
-
-		if (isset($options['data'])) {
-			$this->set($options['data']);
-			unset($options['data']);
-		}
-		$defaults = array(
-			'status'     => null,
-			'location'   => false,
-			'data'       => null,
-			'head'       => false,
-			'controller' => Inflector::underscore($name),
-			'library'    => Libraries::get($class)
-		);
-
-		$options += $this->_render + $defaults;
-
-		if ($key && $media::type($key)) {
-			$options['type'] = $key;
-			$this->set($options[$key]);
-			unset($options[$key]);
-		}
-
-		$this->_render['hasRendered'] = true;
-		$this->response->type($options['type']);
-		$this->response->status($options['status']);
-		$this->response->headers('Location', $options['location']);
-
-		if ($options['head']) {
-			return;
-		}
-		$response = $media::render($this->response, $this->_render['data'], $options + array(
-			'request' => $this->request
-		));
-		return ($this->response = $response ?: $this->response);
-	}
-
-	/**
-	 * Creates a redirect response by calling `render()` and providing a `'location'` parameter.
-	 *
-	 * @see lithium\net\http\Router::match()
-	 * @see lithium\action\Controller::$response
-	 * @param mixed $url The location to redirect to, provided as a string relative to the root of
-	 *              the application, a fully-qualified URL, or an array of routing parameters to be
-	 *              resolved to a URL. Post-processed by `Router::match()`.
-	 * @param array $options Options when performing the redirect. Available options include:
-	 *              - `'status'` _integer_: The HTTP status code associated with the redirect.
-	 *                Defaults to `302`.
-	 *              - `'head'` _boolean_: Determines whether only headers are returned with the
-	 *                response. Defaults to `true`, in which case only headers and no body are
-	 *                returned. Set to `false` to render a body as well.
-	 *              - `'exit'` _boolean_: Exit immediately after rendering. Defaults to `false`.
-	 *                Because `redirect()` does not exit by default, you should always prefix calls
-	 *                with a `return` statement, so that the action is always immediately exited.
-	 * @return object Returns the instance of the `Response` object associated with this controller.
-	 * @filter This method can be filtered.
-	 */
-	public function redirect($url, array $options = array()) {
-		$router = $this->_classes['router'];
-		$defaults = array('location' => null, 'status' => 302, 'head' => true, 'exit' => false);
-		$options += $defaults;
-		$params = compact('url', 'options');
-
-		$this->_filter(__METHOD__, $params, function($self, $params) use ($router) {
-			$options = $params['options'];
-			$location = $options['location'] ?: $router::match($params['url'], $self->request);
-			$self->render(compact('location') + $options);
-		});
-
-		if ($options['exit']) {
-			$this->response->render();
-			$this->_stop();
-		}
-		return $this->response;
-	}
-}
-
-?>

+ 0 - 21
frameworks/PHP/php-lithium/libraries/lithium/action/DispatchException.php

@@ -1,21 +0,0 @@
-<?php
-/**
- * Lithium: the most rad php framework
- *
- * @copyright     Copyright 2012, Union of RAD (http://union-of-rad.org)
- * @license       http://opensource.org/licenses/bsd-license.php The BSD License
- */
-
-namespace lithium\action;
-
-/**
- * This exception covers a range of scenarios that generally revolve around attempting to dispatch
- * to something which cannot handle a request, i.e. a controller which can't be found, objects
- * which aren't callable, or un-routable (private) controller methods.
- */
-class DispatchException extends \RuntimeException {
-
-	protected $code = 404;
-}
-
-?>

+ 0 - 269
frameworks/PHP/php-lithium/libraries/lithium/action/Dispatcher.php

@@ -1,269 +0,0 @@
-<?php
-/**
- * Lithium: the most rad php framework
- *
- * @copyright     Copyright 2012, Union of RAD (http://union-of-rad.org)
- * @license       http://opensource.org/licenses/bsd-license.php The BSD License
- */
-
-namespace lithium\action;
-
-use lithium\util\String;
-use lithium\util\Inflector;
-use lithium\core\Libraries;
-use lithium\action\DispatchException;
-use lithium\core\ClassNotFoundException;
-
-/**
- * `Dispatcher` is the outermost layer of the framework, responsible for both receiving the initial
- * HTTP request and sending back a response at the end of the request's life cycle.
- *
- * After either receiving or instantiating a `Request` object instance, the `Dispatcher` passes that
- * instance to the `Router`, which produces the parameters necessary to dispatch the request
- * (unless no route matches, in which case an exception is thrown).
- *
- * Using these parameters, the `Dispatcher` loads and instantiates the correct `Controller` object,
- * and passes it the `Request` object instance. The `Controller` returns a `Response` object to the
- * `Dispatcher`, where the headers and content are rendered and sent to the browser.
- *
- * @see lithium\net\http\Router
- * @see lithium\action\Request
- * @see lithium\action\Response
- * @see lithium\action\Controller
- */
-class Dispatcher extends \lithium\core\StaticObject {
-
-	/**
-	 * Fully-namespaced router class reference.  Class must implement a `parse()` method,
-	 * which must return an array with (at a minimum) 'controller' and 'action' keys.
-	 *
-	 * @see lithium\net\http\Router::parse()
-	 * @var array
-	 */
-	protected static $_classes = array(
-		'router' => 'lithium\net\http\Router'
-	);
-
-	/**
-	 * Contains pre-process format strings for changing Dispatcher's behavior based on 'rules'.
-	 *
-	 * Each key in the array represents a 'rule'; if a key that matches the rule is present (and
-	 * not empty) in a route, (i.e. the result of `lithium\net\http\Router::parse()`) then the
-	 * rule's value will be applied to the route before it is dispatched.  When applying a rule, any
-	 * array elements of the flag which are present in the route will be modified
-	 * using a `lithium\util\String::insert()`-formatted string.  Alternatively,
-	 * a callback can be used to do custom transformations other than the
-	 * default `lithium\util\String::insert()`.
-	 *
-	 * For example, to implement action prefixes (i.e. `admin_index()`), set a rule named 'admin',
-	 * with a value array containing a modifier key for the `action` element of a route, i.e.:
-	 * `array('action' => 'admin_{:action}')`. Now, if the `'admin'` key is present and not empty
-	 * in the parameters returned from routing, the value of `'action'` will be rewritten per the
-	 * settings in the rule.
-	 *
-	 * Here's another example.  To support normalizing actions,
-	 * set a rule named 'action' with a value array containing a callback that uses
-	 * `lithium\util\Inflector` to camelize the action:
-	 *
-	 * {{{
-	 * use lithium\action\Dispatcher;
-	 * use lithium\util\Inflector;
-	 *
-	 * Dispatcher::config(array('rules' => array(
-	 * 	'action' => array('action' => function($params) {
-	 * 		return Inflector::camelize(strtolower($params['action']), false);
-	 * 	})
-	 * )));
-	 * }}}
-	 *
-	 * The rules can be a callback as well:
-	 *
-	 * {{{
-	 * Dispatcher::config(array('rules' => function($params) {
-	 * 	if (isset($params['admin'])) {
-	 * 		return array('special' => array('action' => 'special_{:action}'));
-	 * 	}
-	 * 	return array();
-	 * }));
-	 * }}}
-	 *
-	 * @see lithium\action\Dispatcher::config()
-	 * @see lithium\util\String::insert()
-	 */
-	protected static $_rules = array();
-
-	/**
-	 * Used to set configuration parameters for the `Dispatcher`.
-	 *
-	 * @see lithium\action\Dispatcher::$_rules
-	 * @param array $config Possible key settings are `'classes'` which sets the class dependencies
-	 *              for `Dispatcher` (i.e. `'request'` or `'router'`) and `'rules'`, which sets the
-	 *              pre-processing rules for routing parameters. For more information on the
-	 *              `'rules'` setting, see the `$_rules` property.
-	 * @return array If no parameters are passed, returns an associative array with the current
-	 *         configuration, otherwise returns `null`.
-	 */
-	public static function config(array $config = array()) {
-		if (!$config) {
-			return array('rules' => static::$_rules);
-		}
-
-		foreach ($config as $key => $val) {
-			$key = "_{$key}";
-			if (!is_array($val)) {
-				static::${$key} = $val;
-				continue;
-			}
-			if (isset(static::${$key})) {
-				static::${$key} = $val + static::${$key};
-			}
-		}
-	}
-
-	/**
-	 * Dispatches a request based on a request object (an instance or subclass of
-	 * `lithium\net\http\Request`).
-	 *
-	 * @see lithium\action\Request
-	 * @see lithium\action\Response
-	 * @param object $request An instance of a request object (usually `lithium\action\Request`)
-	 *               with HTTP request information.
-	 * @param array $options
-	 * @return mixed Returns the value returned from the callable object retrieved from
-	 *         `Dispatcher::_callable()`, which is either a string or an instance of
-	 *         `lithium\action\Response`.
-	 * @filter
-	 */
-	public static function run($request, array $options = array()) {
-		$router = static::$_classes['router'];
-		$params = compact('request', 'options');
-
-		return static::_filter(__FUNCTION__, $params, function($self, $params) use ($router) {
-			$request = $params['request'];
-			$options = $params['options'];
-
-			if (($result = $router::process($request)) instanceof Response) {
-				return $result;
-			}
-			$params = $self::applyRules($result->params);
-
-			if (!$params) {
-				throw new DispatchException('Could not route request.');
-			}
-			$callable = $self::invokeMethod('_callable', array($result, $params, $options));
-			return $self::invokeMethod('_call', array($callable, $result, $params));
-		});
-	}
-
-	/**
-	 * Attempts to apply a set of formatting rules from `$_rules` to a `$params` array, where each
-	 * formatting rule is applied if the key of the rule in `$_rules` is present and not empty in
-	 * `$params`.  Also performs sanity checking against `$params` to ensure that no value
-	 * matching a rule is present unless the rule check passes.
-	 *
-	 * @param array $params An array of route parameters to which rules will be applied.
-	 * @return array Returns the `$params` array with formatting rules applied to array values.
-	 */
-	public static function applyRules(&$params) {
-		$result = array();
-		$values = array();
-		$rules = static::$_rules;
-
-		if (!$params) {
-			return false;
-		}
-
-		if (isset($params['controller']) && is_string($params['controller'])) {
-			$controller = $params['controller'];
-
-			if (strpos($controller, '.') !== false) {
-				list($library, $controller) = explode('.', $controller);
-				$controller = $library . '.' . Inflector::camelize($controller);
-				$params += compact('library');
-			} elseif (strpos($controller, '\\') === false) {
-				$controller = Inflector::camelize($controller);
-
-				if (isset($params['library'])) {
-					$controller = "{$params['library']}.{$controller}";
-				}
-			}
-			$values = compact('controller');
-		}
-		$values += $params;
-
-		if (is_callable($rules)) {
-			$rules = $rules($params);
-		}
-		foreach ($rules as $rule => $value) {
-			if (!isset($values[$rule])) {
-				continue;
-			}
-			foreach ($value as $k => $v) {
-				if (is_callable($v)) {
-					$result[$k] = $v($values);
-					continue;
-				}
-				$match = preg_replace('/\{:\w+\}/', '@', $v);
-				$match = preg_replace('/@/', '.+', preg_quote($match, '/'));
-				if (preg_match('/' . $match . '/i', $values[$k])) {
-					continue;
-				}
-				$result[$k] = String::insert($v, $values);
-			}
-		}
-		return $result + $values;
-	}
-
-	/**
-	 * Accepts parameters generated by the `Router` class in `Dispatcher::run()`, and produces a
-	 * callable controller object. By default, this method uses the `'controller'` path lookup
-	 * configuration in `Libraries::locate()` to return a callable object.
-	 *
-	 * @param object $request The instance of the `Request` class either passed into or generated by
-	 *               `Dispatcher::run()`.
-	 * @param array $params The parameter array generated by routing the request.
-	 * @param array $options Not currently implemented.
-	 * @return object Returns a callable object which the request will be routed to.
-	 * @filter
-	 */
-	protected static function _callable($request, $params, $options) {
-		$params = compact('request', 'params', 'options');
-
-		return static::_filter(__FUNCTION__, $params, function($self, $params) {
-			$options = array('request' => $params['request']) + $params['options'];
-			$controller = $params['params']['controller'];
-
-			try {
-				return Libraries::instance('controllers', $controller, $options);
-			} catch (ClassNotFoundException $e) {
-				throw new DispatchException("Controller `{$controller}` not found.", null, $e);
-			}
-		});
-	}
-
-	/**
-	 * Invokes the callable object returned by `_callable()`, and returns the results, usually a
-	 * `Response` object instance.
-	 *
-	 * @see lithium\action
-	 * @param object $callable Typically a closure or instance of `lithium\action\Controller`.
-	 * @param object $request An instance of `lithium\action\Request`.
-	 * @param array $params An array of parameters to pass to `$callable`, along with `$request`.
-	 * @return mixed Returns the return value of `$callable`, usually an instance of
-	 *         `lithium\action\Response`.
-	 * @throws lithium\action\DispatchException Throws an exception if `$callable` is not a
-	 *         `Closure`, or does not declare the PHP magic `__invoke()` method.
-	 * @filter
-	 */
-	protected static function _call($callable, $request, $params) {
-		$params = compact('callable', 'request', 'params');
-		return static::_filter(__FUNCTION__, $params, function($self, $params) {
-			if (is_callable($callable = $params['callable'])) {
-				return $callable($params['request'], $params['params']);
-			}
-			throw new DispatchException('Result not callable.');
-		});
-	}
-}
-
-?>

+ 0 - 640
frameworks/PHP/php-lithium/libraries/lithium/action/Request.php

@@ -1,640 +0,0 @@
-<?php
-/**
- * Lithium: the most rad php framework
- *
- * @copyright     Copyright 2012, Union of RAD (http://union-of-rad.org)
- * @license       http://opensource.org/licenses/bsd-license.php The BSD License
- */
-
-namespace lithium\action;
-
-use lithium\util\Set;
-use lithium\util\Validator;
-
-/**
- * A `Request` object is passed into the `Dispatcher`, and is responsible for identifying and
- * storing all the information about an HTTP request made to an application,  including status,
- * headers, and any GET, POST or PUT data, as well as any data returned from the
- * `Router`, after the `Request` object has been matched against a `Route`. Includes a property
- * accessor method (`__get()`) which allows any parameters returned from routing to be accessed as
- * properties of the `Request` object.
- *
- * @see lithium\action\Dispatcher
- * @see lithium\action\Controller
- * @see lithium\net\http\Router
- * @see lithium\net\http\Route
- * @see lithium\action\Request::__get()
- */
-class Request extends \lithium\net\http\Request {
-
-	/**
-	 * Current url of request.
-	 *
-	 * @var string
-	 */
-	public $url = null;
-
-	/**
-	 * Params for request.
-	 *
-	 * @var array
-	 */
-	public $params = array();
-
-	/**
-	 * Route parameters that should persist when generating URLs in this request context.
-	 *
-	 * @var array
-	 */
-	public $persist = array();
-
-	/**
-	 * POST data.
-	 *
-	 * @var data
-	 */
-	public $data = array();
-
-	/**
-	 * GET data.
-	 *
-	 * @var string
-	 */
-	public $query = array();
-
-	/**
-	 * Base path.
-	 *
-	 * @var string
-	 */
-	protected $_base = null;
-
-	/**
-	 * Holds the environment variables for the request. Retrieved with env().
-	 *
-	 * @var array
-	 * @see lithium\action\Request::env()
-	 */
-	protected $_env = array();
-
-	/**
-	 * Classes used by `Request`.
-	 *
-	 * @var array
-	 */
-	protected $_classes = array('media' => 'lithium\net\http\Media');
-
-	/**
-	 * If POST / PUT data is coming from an input stream (rather than `$_POST`), this specified
-	 * where to read it from.
-	 *
-	 * @var stream
-	 */
-	protected $_stream = null;
-
-	/**
-	 * Options used to detect request type.
-	 *
-	 * @see lithium\action\Request::detect()
-	 * @var array
-	 */
-	protected $_detectors = array(
-		'mobile'  => array('HTTP_USER_AGENT', null),
-		'ajax'    => array('HTTP_X_REQUESTED_WITH', 'XMLHttpRequest'),
-		'flash'   => array('HTTP_USER_AGENT', 'Shockwave Flash'),
-		'ssl'     => 'HTTPS',
-		'get'     => array('REQUEST_METHOD', 'GET'),
-		'post'    => array('REQUEST_METHOD', 'POST'),
-		'put'     => array('REQUEST_METHOD', 'PUT'),
-		'delete'  => array('REQUEST_METHOD', 'DELETE'),
-		'head'    => array('REQUEST_METHOD', 'HEAD'),
-		'options' => array('REQUEST_METHOD', 'OPTIONS')
-	);
-
-	/**
-	 * Auto configuration properties.
-	 *
-	 * @var array
-	 */
-	protected $_autoConfig = array(
-		'classes' => 'merge', 'env', 'detectors' => 'merge', 'base', 'type', 'stream'
-	);
-
-	/**
-	 * Contains an array of content-types, sorted by quality (the priority which the browser
-	 * requests each type).
-	 *
-	 * @var array
-	 */
-	protected $_acceptContent = array();
-
-	/**
-	 * Holds the value of the current locale, set through the `locale()` method.
-	 *
-	 * @var string
-	 */
-	protected $_locale = null;
-
-	/**
-	 * Initialize request object, pulling request data from superglobals.
-	 *
-	 * Defines an artificial `'PLATFORM'` environment variable as either
-	 * `'IIS'`, `'CGI'` or `null` to allow checking for the SAPI in a
-	 * normalized way.
-	 *
-	 * @return void
-	 */
-	protected function _init() {
-		parent::_init();
-
-		$mobile = array(
-			'iPhone', 'MIDP', 'AvantGo', 'BlackBerry', 'J2ME', 'Opera Mini', 'DoCoMo', 'NetFront',
-			'Nokia', 'PalmOS', 'PalmSource', 'portalmmm', 'Plucker', 'ReqwirelessWeb', 'iPod',
-			'SonyEricsson', 'Symbian', 'UP\.Browser', 'Windows CE', 'Xiino', 'Android'
-		);
-		if (!empty($this->_config['detectors']['mobile'][1])) {
-			$mobile = array_merge($mobile, (array) $this->_config['detectors']['mobile'][1]);
-		}
-		$this->_detectors['mobile'][1] = $mobile;
-		$defaults = array('REQUEST_METHOD' => 'GET', 'CONTENT_TYPE' => 'text/html');
-		$this->_env += (array) $_SERVER + (array) $_ENV + $defaults;
-		$envs = array('isapi' => 'IIS', 'cgi' => 'CGI', 'cgi-fcgi' => 'CGI');
-		$this->_env['PLATFORM'] = isset($envs[PHP_SAPI]) ? $envs[PHP_SAPI] : null;
-		$this->_base = $this->_base();
-		$this->url = $this->_url();
-
-		if (!empty($this->_config['query'])) {
-			$this->query = $this->_config['query'];
-		}
-		if (isset($_GET)) {
-			$this->query += $_GET;
-		}
-		if (!empty($this->_config['data'])) {
-			$this->data = $this->_config['data'];
-		}
-		if (isset($_POST)) {
-			$this->data += $_POST;
-		}
-		if (isset($this->data['_method'])) {
-			$this->_env['HTTP_X_HTTP_METHOD_OVERRIDE'] = strtoupper($this->data['_method']);
-			unset($this->data['_method']);
-		}
-		if (!empty($this->_env['HTTP_X_HTTP_METHOD_OVERRIDE'])) {
-			$this->_env['REQUEST_METHOD'] = $this->_env['HTTP_X_HTTP_METHOD_OVERRIDE'];
-		}
-		$type = $this->type($this->_config['type'] ?: $this->env('CONTENT_TYPE'));
-		$this->method = $method = strtoupper($this->_env['REQUEST_METHOD']);
-		$hasBody = in_array($method, array('POST', 'PUT', 'PATCH'));
-
-		if (!$this->data && $hasBody && $type !== 'html') {
-			$this->_stream = $this->_stream ?: fopen('php://input', 'r');
-			$media = $this->_classes['media'];
-			$this->data = (array) $media::decode($type, stream_get_contents($this->_stream));
-			fclose($this->_stream);
-		}
-		$this->data = Set::merge((array) $this->data, $this->_parseFiles());
-	}
-
-	/**
-	 * Allows request parameters to be accessed as object properties, i.e. `$this->request->action`
-	 * instead of `$this->request->params['action']`.
-	 *
-	 * @see lithium\action\Request::$params
-	 * @param string $name The property name/parameter key to return.
-	 * @return mixed Returns the value of `$params[$name]` if it is set, otherwise returns null.
-	 */
-	public function __get($name) {
-		if (isset($this->params[$name])) {
-			return $this->params[$name];
-		}
-	}
-
-	/**
-	 * Allows request parameters to be checked using short-hand notation. See the `__get()` method
-	 * for more details.
-	 *
-	 * @see lithium\action\Request::__get()
-	 * @param string $name The name of the request parameter to check.
-	 * @return boolean Returns true if the key in `$name` is set in the `$params` array, otherwise
-	 *         `false`.
-	 */
-	public function __isset($name) {
-		return isset($this->params[$name]);
-	}
-
-	/**
-	 * Queries PHP's environment settings, and provides an abstraction for standardizing expected
-	 * environment values across varying platforms, as well as specify custom environment flags.
-	 *
-	 * @param string $key The environment variable required.
-	 * @return string The requested variables value.
-	 * @todo Refactor to lazy-load environment settings
-	 */
-	public function env($key) {
-		if (strtolower($key) === 'base') {
-			return $this->_base;
-		}
-
-		if ($key === 'SCRIPT_NAME' && !isset($this->_env['SCRIPT_NAME'])) {
-			if ($this->_env['PLATFORM'] === 'CGI' || isset($this->_env['SCRIPT_URL'])) {
-				$key = 'SCRIPT_URL';
-			}
-		}
-
-		$val = array_key_exists($key, $this->_env) ? $this->_env[$key] : getenv($key);
-		$this->_env[$key] = $val;
-
-		if ($key == 'REMOTE_ADDR') {
-			$https = array('HTTP_X_FORWARDED_FOR', 'HTTP_PC_REMOTE_ADDR', 'HTTP_X_REAL_IP');
-			foreach ($https as $altKey) {
-				if ($addr = $this->env($altKey)) {
-					$val = $addr;
-					break;
-				}
-			}
-		}
-
-		if ($val !== null && $val !== false && $key !== 'HTTPS') {
-			return $val;
-		}
-
-		switch ($key) {
-			case 'HTTPS':
-				if (isset($this->_env['SCRIPT_URI'])) {
-					return (strpos($this->_env['SCRIPT_URI'], 'https://') === 0);
-				}
-				if (isset($this->_env['HTTPS'])) {
-					return (!empty($this->_env['HTTPS']) && $this->_env['HTTPS'] !== 'off');
-				}
-				return false;
-			case 'SERVER_ADDR':
-				if (empty($this->_env['SERVER_ADDR']) && !empty($this->_env['LOCAL_ADDR'])) {
-					return $this->_env['LOCAL_ADDR'];
-				}
-				return $this->_env['SERVER_ADDR'];
-			case 'SCRIPT_FILENAME':
-				if ($this->_env['PLATFORM'] == 'IIS') {
-					return str_replace('\\\\', '\\', $this->env('PATH_TRANSLATED'));
-				}
-				return $this->env('DOCUMENT_ROOT') . $this->env('PHP_SELF');
-			case 'DOCUMENT_ROOT':
-				$fileName = $this->env('SCRIPT_FILENAME');
-				$offset = (!strpos($this->env('SCRIPT_NAME'), '.php')) ? 4 : 0;
-				$offset = strlen($fileName) - (strlen($this->env('SCRIPT_NAME')) + $offset);
-				return substr($fileName, 0, $offset);
-			case 'PHP_SELF':
-				return str_replace('\\', '/', str_replace(
-					$this->env('DOCUMENT_ROOT'), '', $this->env('SCRIPT_FILENAME')
-				));
-			case 'CGI':
-			case 'CGI_MODE':
-				return ($this->_env['PLATFORM'] === 'CGI');
-			case 'HTTP_BASE':
-				return preg_replace('/^([^.])*/i', null, $this->_env['HTTP_HOST']);
-		}
-	}
-
-	/**
-	 * Returns information about the type of content that the client is requesting.
-	 *
-	 * @see lithium\net\http\Media::negotiate()
-	 * @param $type mixed If not specified, returns the media type name that the client prefers,
-	 *              using content negotiation. If a media type name (string) is passed, returns
-	 *              `true` or `false`, indicating whether or not that type is accepted by the client
-	 *              at all. If `true`, returns the raw content types from the `Accept` header,
-	 *              parsed into an array and sorted by client preference.
-	 * @return string Returns a simple type name if the type is registered (i.e. `'json'`), or
-	 *         a fully-qualified content-type if not (i.e. `'image/jpeg'`), or a boolean or array,
-	 *         depending on the value of `$type`.
-	 */
-	public function accepts($type = null) {
-		if ($type === true) {
-			return $this->_parseAccept();
-		}
-		if (!$type && isset($this->params['type'])) {
-			return $this->params['type'];
-		}
-		$media = $this->_classes['media'];
-		return $media::negotiate($this) ?: 'html';
-	}
-
-	protected function _parseAccept() {
-		if ($this->_acceptContent) {
-			return $this->_acceptContent;
-		}
-		$accept = $this->env('HTTP_ACCEPT');
-		$accept = (preg_match('/[a-z,-]/i', $accept)) ? explode(',', $accept) : array('text/html');
-
-		foreach (array_reverse($accept) as $i => $type) {
-			unset($accept[$i]);
-			list($type, $q) = (explode(';q=', $type, 2) + array($type, 1.0 + $i / 100));
-			$accept[$type] = ($type === '*/*') ? 0.1 : floatval($q);
-		}
-		arsort($accept, SORT_NUMERIC);
-
-		if (isset($accept['application/xhtml+xml']) && $accept['application/xhtml+xml'] >= 1) {
-			unset($accept['application/xml']);
-		}
-		$media = $this->_classes['media'];
-
-		if (isset($this->params['type']) && ($handler = $media::type($this->params['type']))) {
-			if (isset($handler['content'])) {
-				$type = (array) $handler['content'];
-				$accept = array(current($type) => 1) + $accept;
-			}
-		}
-		return $this->_acceptContent = array_keys($accept);
-	}
-
-	/**
-	 * This method allows easy extraction of any request data using a prefixed key syntax. By
-	 * passing keys in the form of `'prefix:key'`, it is possible to query different information of
-	 * various different types, including GET and POST data, and server environment variables. The
-	 * full list of prefixes is as follows:
-	 *
-	 * - `'data'`: Retrieves values from POST data.
-	 * - `'params'`: Retrieves query parameters returned from the routing system.
-	 * - `'query'`: Retrieves values from GET data.
-	 * - `'env'`: Retrieves values from the server or environment, such as `'env:https'`, or custom
-	 *   environment values, like `'env:base'`. See the `env()` method for more info.
-	 * - `'http'`: Retrieves header values (i.e. `'http:accept'`), or the HTTP request method (i.e.
-	 *   `'http:method'`).
-	 *
-	 * This method is used in several different places in the framework in order to provide the
-	 * ability to act conditionally on different aspects of the request. See `Media::type()` (the
-	 * section on content negotiation) and the routing system for more information.
-	 *
-	 *  _Note_: All keys should be _lower-cased_, even when getting HTTP headers.
-	 * @see lithium\action\Request::env()
-	 * @see lithium\net\http\Media::type()
-	 * @see lithium\net\http\Router
-	 * @param string $key A prefixed key indicating what part of the request data the requested
-	 *               value should come from, and the name of the value to retrieve, in lower case.
-	 * @return string Returns the value of a GET, POST, routing or environment variable, or an
-	 *         HTTP header or method name.
-	 */
-	public function get($key) {
-		list($var, $key) = explode(':', $key);
-
-		switch (true) {
-			case in_array($var, array('params', 'data', 'query')):
-				return isset($this->{$var}[$key]) ? $this->{$var}[$key] : null;
-			case ($var === 'env'):
-				return $this->env(strtoupper($key));
-			case ($var === 'http' && $key === 'method'):
-				return $this->env('REQUEST_METHOD');
-			case ($var === 'http'):
-				return $this->env('HTTP_' . strtoupper($key));
-		}
-	}
-
-	/**
-	 * Provides a simple syntax for making assertions about the properties of a request.
-	 * By default, the `Request` object is configured with several different types of assertions,
-	 * which are individually known as _detectors_. Detectors are invoked by calling the `is()` and
-	 * passing the name of the detector flag, i.e. `$request->is('<name>')`, which returns `true` or
-	 * `false`, depending on whether or not the the properties (usually headers or data) contained
-	 * in the request match the detector. The default detectors include the following:
-	 *
-	 * - `'mobile'`: Uses a regular expression to match common mobile browser user agents.
-	 * - `'ajax'`: Checks to see if the `X-Requested-With` header is present, and matches the value
-	 *    `'XMLHttpRequest'`.
-	 * - `'flash'`: Checks to see if the user agent is `'Shockwave Flash'`.
-	 * - `'ssl'`: Verifies that the request is SSL-secured.
-	 * - `'get'` / `'post'` / `'put'` / `'delete'` / `'head'` / `'options'`: Checks that the HTTP
-	 *   request method matches the one specified.
-	 *
-	 * In addition to the above, this method also accepts media type names (see `Media::type()`) to
-	 * make assertions against the format of the request body (for POST or PUT requests), i.e.
-	 * `$request->is('json')`. This will return `true` if the client has made a POST request with
-	 * JSON data.
-	 *
-	 * For information about adding custom detectors or overriding the ones in the core, see the
-	 * `detect()` method.
-	 *
-	 * While these detectors are useful in controllers or other similar contexts, they're also
-	 * useful when performing _content negotiation_, which is the process of modifying the response
-	 * format to suit the client (see the `'conditions'` field of the `$options` parameter in
-	 * `Media::type()`).
-	 *
-	 * @see lithium\action\Request::detect()
-	 * @see lithium\net\http\Media::type()
-	 * @param string $flag The name of the flag to check, which should be the name of a valid
-	 *               detector (that is either built-in or defined with `detect()`).
-	 * @return boolean Returns `true` if the detector check succeeds (see the details for the
-	 *         built-in detectors above, or `detect()`), otherwise `false`.
-	 */
-	public function is($flag) {
-		$media = $this->_classes['media'];
-
-		if (!isset($this->_detectors[$flag])) {
-			if (!in_array($flag, $media::types())) {
-				return false;
-			}
-			return $this->type() == $flag;
-		}
-		$detector = $this->_detectors[$flag];
-
-		if (!is_array($detector) && is_callable($detector)) {
-			return $detector($this);
-		}
-		if (!is_array($detector)) {
-			return (boolean) $this->env($detector);
-		}
-		list($key, $check) = $detector + array('', '');
-
-		if (is_array($check)) {
-			$check = '/' . join('|', $check) . '/i';
-		}
-		if (Validator::isRegex($check)) {
-			return (boolean) preg_match($check, $this->env($key));
-		}
-		return ($this->env($key) == $check);
-	}
-
-	/**
-	 * Sets/Gets the content type. If `'type'` is null, the method will attempt to determine the
-	 * type from the params, then from the environment setting
-	 *
-	 * @param string $type a full content type i.e. `'application/json'` or simple name `'json'`
-	 * @return string A simple content type name, i.e. `'html'`, `'xml'`, `'json'`, etc., depending
-	 *         on the content type of the request.
-	 */
-	public function type($type = null) {
-		if (!$type && !empty($this->params['type'])) {
-			$type = $this->params['type'];
-		}
-		return parent::type($type);
-	}
-
-	/**
-	 * Creates a _detector_ used with `Request::is()`.  A detector is a boolean check that is
-	 * created to determine something about a request.
-	 *
-	 * A detector check can be either an exact string match or a regular expression match against a
-	 * header or environment variable. A detector check can also be a closure that accepts the
-	 * `Request` object instance as a parameter.
-	 *
-	 * For example, to detect whether a request is from an iPhone, you can do the following:
-	 * {{{ embed:lithium\tests\cases\action\RequestTest::testDetect(11-12) }}}
-	 *
-	 * @see lithium\action\Request::is()
-	 * @param string $flag The name of the detector check. Used in subsequent calls to
-	 *               `Request::is()`.
-	 * @param mixed $detector Detectors can be specified in four different ways:
-	 *              - The name of an HTTP header or environment variable. If a string, calling the
-	 *                detector will check that the header or environment variable exists and is set
-	 *                to a non-empty value.
-	 *              - A two-element array containing a header/environment variable name, and a value
-	 *                to match against. The second element of the array must be an exact match to
-	 *                the header or variable value.
-	 *              - A two-element array containing a header/environment variable name, and a
-	 *                regular expression that matches against the value, as in the example above.
-	 *              - A closure which accepts an instance of the `Request` object and returns a
-	 *                boolean value.
-	 * @return void
-	 */
-	public function detect($flag, $detector = null) {
-		if (is_array($flag)) {
-			$this->_detectors = $flag + $this->_detectors;
-		} else {
-			$this->_detectors[$flag] = $detector;
-		}
-	}
-
-	/**
-	 * Gets the referring URL of this request.
-	 *
-	 * @param string $default Default URL to use if HTTP_REFERER cannot be read from headers.
-	 * @param boolean $local If true, restrict referring URLs to local server.
-	 * @return string Referring URL.
-	 */
-	public function referer($default = null, $local = false) {
-		if ($ref = $this->env('HTTP_REFERER')) {
-			if (!$local) {
-				return $ref;
-			}
-			if (strpos($ref, '://') === false) {
-				return $ref;
-			}
-		}
-		return ($default != null) ? $default : '/';
-	}
-
-	/**
-	 * Overrides `lithium\net\http\Request::to()` to provide the correct options for generating
-	 * URLs. For information about this method, see the parent implementation.
-	 *
-	 * @see lithium\net\http\Request::to()
-	 * @param string $format The format to convert to.
-	 * @param array $options Override options.
-	 * @return mixed The return value type depends on `$format`.
-	 */
-	public function to($format, array $options = array()) {
-		$defaults = array(
-			'scheme' => $this->env('HTTPS') ? 'https' : 'http',
-			'host' => $this->env('HTTP_HOST'),
-			'path' => $this->_base . '/' . $this->url
-		);
-		return parent::to($format, $options + $defaults);
-	}
-
-	/**
-	 * Sets or returns the current locale string. For more information, see
-	 * "[Globalization](http://lithify.me/docs/manual/07_globalization)" in the manual.
-	 *
-	 * @param string $locale An optional locale string like `'en'`, `'en_US'` or `'de_DE'`. If
-	 *               specified, will overwrite the existing locale.
-	 * @return Returns the currently set locale string.
-	 */
-	public function locale($locale = null) {
-		if ($locale) {
-			$this->_locale = $locale;
-		}
-		if ($this->_locale) {
-			return $this->_locale;
-		}
-		if (isset($this->params['locale'])) {
-			return $this->params['locale'];
-		}
-	}
-
-	/**
-	 * Find the base path of the current request.
-	 *
-	 * @todo Replace string directory names with configuration.
-	 * @return string
-	 */
-	protected function _base() {
-		if (isset($this->_base)) {
-			return $this->_base;
-		}
-		$base = str_replace('\\', '/', dirname($this->env('PHP_SELF')));
-		return rtrim(str_replace(array("/app/webroot", '/webroot'), '', $base), '/');
-	}
-
-	/**
-	 * Return the full url of the current request.
-	 *
-	 * @return string
-	 */
-	protected function _url() {
-		if (isset($this->_config['url'])) {
-			return rtrim($this->_config['url'], '/');
-		}
-		if (!empty($_GET['url'])) {
-			return rtrim($_GET['url'], '/');
-		}
-		if ($uri = $this->env('REQUEST_URI')) {
-			list($uri) = explode('?', $uri, 2);
-			$base = '/^' . preg_quote($this->env('base'), '/') . '/';
-			return trim(preg_replace($base, '', $uri), '/') ?: '/';
-		}
-		return '/';
-	}
-
-	/**
-	 * Normalize the data in $_FILES
-	 *
-	 * @return array
-	 */
-	protected function _parseFiles() {
-		if (isset($_FILES) && $_FILES) {
-			$result = array();
-
-			$normalize = function($key, $value) use ($result, &$normalize){
-				foreach ($value as $param => $content) {
-					foreach ($content as $num => $val) {
-						if (is_numeric($num)) {
-							$result[$key][$num][$param] = $val;
-							continue;
-						}
-						if (is_array($val)) {
-							foreach ($val as $next => $one) {
-								$result[$key][$num][$next][$param] = $one;
-							}
-							continue;
-						}
-						$result[$key][$num][$param] = $val;
-					}
-				}
-				return $result;
-			};
-			foreach ($_FILES as $key => $value) {
-				if (isset($value['name'])) {
-					if (is_string($value['name'])) {
-						$result[$key] = $value;
-						continue;
-					}
-					if (is_array($value['name'])) {
-						$result += $normalize($key, $value);
-					}
-				}
-			}
-			return $result;
-		}
-		return array();
-	}
-}
-
-?>

+ 0 - 175
frameworks/PHP/php-lithium/libraries/lithium/action/Response.php

@@ -1,175 +0,0 @@
-<?php
-/**
- * Lithium: the most rad php framework
- *
- * @copyright     Copyright 2012, Union of RAD (http://union-of-rad.org)
- * @license       http://opensource.org/licenses/bsd-license.php The BSD License
- */
-
-namespace lithium\action;
-
-/**
- * A `Response` object is typically instantiated automatically by the `Controller`. It is assigned
- * any headers set in the course of the request, as well as any content rendered by the
- * `Controller`. Once completed, the `Controller` returns the `Response` object to the `Dispatcher`.
- *
- * The `Response` object is responsible for writing its body content to output, and writing any
- * headers to the browser.
- *
- * @see lithium\action\Dispatcher
- * @see lithium\action\Controller
- */
-class Response extends \lithium\net\http\Response {
-
-	/**
-	 * Classes used by Response.
-	 *
-	 * @var array
-	 */
-	protected $_classes = array(
-		'router' => 'lithium\net\http\Router',
-		'media' => 'lithium\net\http\Media'
-	);
-
-	protected $_autoConfig = array('classes' => 'merge');
-
-	public function __construct(array $config = array()) {
-		$defaults = array(
-			'buffer' => 8192,
-			'location' => null,
-			'status' => 0,
-			'request' => null,
-			'decode' => false
-		);
-		parent::__construct($config + $defaults);
-	}
-
-	protected function _init() {
-		parent::_init();
-		$config = $this->_config;
-		$this->status($config['status']);
-		unset($this->_config['status']);
-
-		if ($config['location']) {
-			$classes = $this->_classes;
-			$location = $classes['router']::match($config['location'], $config['request']);
-			$this->headers('Location', $location);
-		}
-	}
-
-	/**
-	 * Controls how or whether the client browser and web proxies should cache this response.
-	 *
-	 * @param mixed $expires This can be a Unix timestamp indicating when the page expires, or a
-	 *              string indicating the relative time offset that a page should expire, i.e.
-	 *              `"+5 hours". Finally, `$expires` can be set to `false` to completely disable
-	 *              browser or proxy caching.
-	 * @return void
-	 */
-	public function cache($expires) {
-		if ($expires === false) {
-			return $this->headers(array(
-				'Expires' => 'Mon, 26 Jul 1997 05:00:00 GMT',
-				'Cache-Control' => array(
-					'no-store, no-cache, must-revalidate',
-					'post-check=0, pre-check=0',
-					'max-age=0'
-				),
-				'Pragma' => 'no-cache'
-			));
-		}
-		$expires = is_int($expires) ? $expires : strtotime($expires);
-
-		return $this->headers(array(
-			'Expires' => gmdate('D, d M Y H:i:s', $expires) . ' GMT',
-			'Cache-Control' => 'max-age=' . ($expires - time()),
-			'Pragma' => 'cache'
-		));
-	}
-
-	/**
-	 * Sets/Gets the content type. If `'type'` is null, the method will attempt to determine the
-	 * type from the params, then from the environment setting
-	 *
-	 * @param string $type a full content type i.e. `'application/json'` or simple name `'json'`
-	 * @return string A simple content type name, i.e. `'html'`, `'xml'`, `'json'`, etc., depending
-	 *         on the content type of the request.
-	 */
-	public function type($type = null) {
-		if ($type === null && $this->_type === null) {
-			$type = 'html';
-		}
-		return parent::type($type);
-	}
-
-	/**
-	 * Render a response by writing headers and output. Output is echoed in chunks because of an
-	 * issue where `echo` time increases exponentially on long message bodies.
-	 *
-	 * @return void
-	 */
-	public function render() {
-		$code = null;
-		$hasLocation = (isset($this->headers['location']) || isset($this->headers['Location']));
-
-		if ($hasLocation && $this->status['code'] === 200) {
-			$code = 302;
-		}
-		$this->_writeHeader($this->status($code) ?: $this->status(500));
-
-		foreach ($this->headers as $name => $value) {
-			$key = strtolower($name);
-
-			if ($key == 'location') {
-				$this->_writeHeader("Location: {$value}", $this->status['code']);
-			} elseif ($key == 'download') {
-				$this->_writeHeader('Content-Disposition: attachment; filename="' . $value . '"');
-			} elseif (is_array($value)) {
-				$this->_writeHeader(
-					array_map(function($v) use ($name) { return "{$name}: {$v}"; }, $value)
-				);
-			} elseif (!is_numeric($name)) {
-				$this->_writeHeader("{$name}: {$value}");
-			}
-		}
-		if ($code == 302 || $code == 204) {
-			return;
-		}
-		$chunked = $this->body(null, $this->_config);
-
-		foreach ($chunked as $chunk) {
-			echo $chunk;
-		}
-	}
-
-	/**
-	 * Casts the Response object to a string.  This doesn't actually return a string, but does
-	 * a direct render and returns null.
-	 *
-	 * @return string An empty string.
-	 */
-	public function __toString() {
-		$this->render();
-		return '';
-	}
-
-	/**
-	 * Writes raw headers to output.
-	 *
-	 * @param string|array $header Either a raw header string, or an array of header strings. Use
-	 *        an array if a single header must be written multiple times with different values.
-	 *        Otherwise, additional values for duplicate headers will overwrite previous values.
-	 * @param integer $code Optional. If present, forces a specific HTTP response code.  Used
-	 *        primarily in conjunction with the 'Location' header.
-	 * @return void
-	 */
-	protected function _writeHeader($header, $code = null) {
-		if (is_array($header)) {
-			array_map(function($h) { header($h, false); }, $header);
-			return;
-		}
-		$code ? header($header, true, $code) : header($header, true);
-	}
-}
-
-?>

+ 0 - 1
frameworks/PHP/php-lithium/libraries/lithium/action/readme.md

@@ -1 +0,0 @@
-The `action` namespace relies on `lithium\http`, and includes classes required to route and dispatch HTTP requests.

+ 0 - 205
frameworks/PHP/php-lithium/libraries/lithium/analysis/Debugger.php

@@ -1,205 +0,0 @@
-<?php
-/**
- * Lithium: the most rad php framework
- *
- * @copyright     Copyright 2012, Union of RAD (http://union-of-rad.org)
- * @license       http://opensource.org/licenses/bsd-license.php The BSD License
- */
-
-namespace lithium\analysis;
-
-use ReflectionClass;
-use lithium\util\String;
-use lithium\analysis\Inspector;
-
-/**
- * The `Debugger` class provides basic facilities for generating and rendering meta-data about the
- * state of an application in its current context.
- */
-class Debugger extends \lithium\core\StaticObject {
-
-	/**
-	 * Used for temporary closure caching.
-	 *
-	 * @see lithium\analysis\Debugger::_closureDef()
-	 * @var array
-	 */
-	protected static $_closureCache = array();
-
-	/**
-	 * Outputs a stack trace based on the supplied options.
-	 *
-	 * @param array $options Format for outputting stack trace. Available options are:
-	 *        - `'args'`: A boolean indicating if arguments should be included.
-	 *        - `'depth'`: The maximum depth of the trace.
-	 *        - `'format'`: Either `null`, `'points'` or `'array'`.
-	 *        - `'includeScope'`: A boolean indicating if items within scope
-	 *           should be included.
-	 *        - `'scope'`: Scope for items to include.
-	 *        - `'start'`: The depth to start with.
-	 *        - `'trace'`: A trace to use instead of generating one.
-	 * @return string Stack trace formatted according to `'format'` option.
-	 */
-	public static function trace(array $options = array()) {
-		$defaults = array(
-			'depth' => 999,
-			'format' => null,
-			'args' => false,
-			'start' => 0,
-			'scope' => array(),
-			'trace' => array(),
-			'includeScope' => true,
-			'closures' => true
-		);
-		$options += $defaults;
-
-		$backtrace = $options['trace'] ?: debug_backtrace();
-		$scope = $options['scope'];
-		$count = count($backtrace);
-		$back = array();
-		$traceDefault = array(
-			'line' => '??', 'file' => '[internal]', 'class' => null, 'function' => '[main]'
-		);
-
-		for ($i = $options['start']; $i < $count && $i < $options['depth']; $i++) {
-			$trace = array_merge(array('file' => '[internal]', 'line' => '??'), $backtrace[$i]);
-			$function = '[main]';
-
-			if (isset($backtrace[$i + 1])) {
-				$next = $backtrace[$i + 1] + $traceDefault;
-				$function = $next['function'];
-
-				if (!empty($next['class'])) {
-					$function = $next['class'] . '::' . $function . '(';
-					if ($options['args'] && isset($next['args'])) {
-						$args = array_map(array('static', 'export'), $next['args']);
-						$function .= join(', ', $args);
-					}
-					$function .= ')';
-				}
-			}
-
-			if ($options['closures'] && strpos($function, '{closure}') !== false) {
-				$function = static::_closureDef($backtrace[$i], $function);
-			}
-			if (in_array($function, array('call_user_func_array', 'trigger_error'))) {
-				continue;
-			}
-			$trace['functionRef'] = $function;
-
-			if ($options['format'] === 'points' && $trace['file'] !== '[internal]') {
-				$back[] = array('file' => $trace['file'], 'line' => $trace['line']);
-			} elseif (is_string($options['format']) && $options['format'] != 'array') {
-				$back[] = String::insert($options['format'], array_map(
-					function($data) { return is_object($data) ? get_class($data) : $data; },
-					$trace
-				));
-			} elseif (empty($options['format'])) {
-				$back[] = $function . ' - ' . $trace['file'] . ', line ' . $trace['line'];
-			} else {
-				$back[] = $trace;
-			}
-
-			if (!empty($scope) && array_intersect_assoc($scope, $trace) == $scope) {
-				if (!$options['includeScope']) {
-					$back = array_slice($back, 0, count($back) - 1);
-				}
-				break;
-			}
-		}
-
-		if ($options['format'] === 'array' || $options['format'] === 'points') {
-			return $back;
-		}
-		return join("\n", $back);
-	}
-
-	/**
-	 * Returns a parseable string representation of a variable.
-	 *
-	 * @param mixed $var The variable to export.
-	 * @return string The exported contents.
-	 */
-	public static function export($var) {
-		$export = var_export($var, true);
-
-		if (is_array($var)) {
-			$replace = array(" (", " )", "  ", " )", "=> \n\t");
-			$with = array("(", ")", "\t", "\t)", "=> ");
-			$export = str_replace($replace, $with, $export);
-		}
-		return $export;
-	}
-
-	/**
-	 * Locates original location of closures.
-	 *
-	 * @param mixed $reference File or class name to inspect.
-	 * @param integer $callLine Line number of class reference.
-	 */
-	protected static function _definition($reference, $callLine) {
-		if (file_exists($reference)) {
-			foreach (array_reverse(token_get_all(file_get_contents($reference))) as $token) {
-				if (!is_array($token) || $token[2] > $callLine) {
-					continue;
-				}
-				if ($token[0] === T_FUNCTION) {
-					return $token[2];
-				}
-			}
-			return;
-		}
-		list($class, $method) = explode('::', $reference);
-
-		if (!class_exists($class)) {
-			return;
-		}
-
-		$classRef = new ReflectionClass($class);
-		$methodInfo = Inspector::info($reference);
-		$methodDef = join("\n", Inspector::lines($classRef->getFileName(), range(
-			$methodInfo['start'] + 1, $methodInfo['end'] - 1
-		)));
-
-		foreach (array_reverse(token_get_all("<?php {$methodDef} ?>")) as $token) {
-			if (!is_array($token) || $token[2] > $callLine) {
-				continue;
-			}
-			if ($token[0] === T_FUNCTION) {
-				return $token[2] + $methodInfo['start'];
-			}
-		}
-	}
-
-	protected static function _closureDef($frame, $function) {
-		$reference = '::';
-		$frame += array('file' => '??', 'line' => '??');
-		$cacheKey = "{$frame['file']}@{$frame['line']}";
-
-		if (isset(static::$_closureCache[$cacheKey])) {
-			return static::$_closureCache[$cacheKey];
-		}
-
-		if ($class = Inspector::classes(array('file' => $frame['file']))) {
-			foreach (Inspector::methods(key($class), 'extents') as $method => $extents) {
-				$line = $frame['line'];
-
-				if (!($extents[0] <= $line && $line <= $extents[1])) {
-					continue;
-				}
-				$class = key($class);
-				$reference = "{$class}::{$method}";
-				$function = "{$reference}()::{closure}";
-				break;
-			}
-		} else {
-			$reference = $frame['file'];
-			$function = "{$reference}::{closure}";
-		}
-		$line = static::_definition($reference, $frame['line']) ?: '?';
-		$function .= " @ {$line}";
-		return static::$_closureCache[$cacheKey] = $function;
-	}
-}
-
-?>

+ 0 - 122
frameworks/PHP/php-lithium/libraries/lithium/analysis/Docblock.php

@@ -1,122 +0,0 @@
-<?php
-/**
- * Lithium: the most rad php framework
- *
- * @copyright     Copyright 2012, Union of RAD (http://union-of-rad.org)
- * @license       http://opensource.org/licenses/bsd-license.php The BSD License
- */
-
-namespace lithium\analysis;
-
-/**
- * A source code doc block parser.
- *
- * This parser may be used as the basis for a variety of secondary tools, including
- * a reflection-based API generator, a code metrics analyzer, and various other code or structural
- * analysis tools.
- */
-class Docblock extends \lithium\core\StaticObject {
-
-	/**
-	 * List of supported docblock tags.
-	 *
-	 * @var array
-	 */
-	public static $tags = array(
-		'todo', 'discuss', 'fix', 'important', 'var',
-		'param', 'return', 'throws', 'see', 'link',
-		'task', 'dependencies', 'filter'
-	);
-
-	/**
-	 * Parses a doc block into its major components of `description`, `text` and `tags`.
-	 *
-	 * @param string $comment The doc block string to be parsed
-	 * @return array An associative array of the parsed comment, whose keys are `description`,
-	 *         `text` and `tags`.
-	 */
-	public static function comment($comment) {
-		$text = null;
-		$tags = array();
-		$description = null;
-		$comment = trim(preg_replace('/^(\s*\/\*\*|\s*\*{1,2}\/|\s*\* ?)/m', '', $comment));
-		$comment = str_replace("\r\n", "\n", $comment);
-
-		if ($items = preg_split('/\n@/ms', $comment, 2)) {
-			list($description, $tags) = $items + array('', '');
-			$tags = $tags ? static::tags("@{$tags}") : array();
-		}
-
-		if (strpos($description, "\n\n")) {
-			list($description, $text) = explode("\n\n", $description, 2);
-		}
-		$text = trim($text);
-		$description = trim($description);
-		return compact('description', 'text', 'tags');
-	}
-
-	/**
-	 * Parses `@<tagname>` docblock tags and their descriptions from a docblock.
-	 *
-	 * See the `$tags` property for the list of supported tags.
-	 *
-	 * @param string $string The string to be parsed for tags
-	 * @return array Returns an array where each docblock tag is a key name, and the corresponding
-	 *         values are either strings (if one of each tag), or arrays (if multiple of the same
-	 *         tag).
-	 */
-	public static function tags($string) {
-		$regex = '/\n@(?P<type>' . join('|', static::$tags) . ")/msi";
-		$string = trim($string);
-
-		$result = preg_split($regex, "\n$string", -1, PREG_SPLIT_DELIM_CAPTURE);
-		$tags = array();
-
-		for ($i = 1; $i < count($result) - 1; $i += 2) {
-			$type = trim(strtolower($result[$i]));
-			$text = trim($result[$i + 1]);
-
-			if (isset($tags[$type])) {
-				$tags[$type] = is_array($tags[$type]) ? $tags[$type] : (array) $tags[$type];
-				$tags[$type][] = $text;
-			} else {
-				$tags[$type] = $text;
-			}
-		}
-
-		if (isset($tags['param'])) {
-			$params = $tags['param'];
-			$tags['params'] = static::_params((array) $tags['param']);
-			unset($tags['param']);
-		}
-		return $tags;
-	}
-
-	/**
-	 * Parses `@param` docblock tags to separate out the parameter type from the description.
-	 *
-	 * @param array $params An array of `@param` tags, as parsed from the `tags()` method.
-	 * @return array Returns an array where each key is a parameter name, and each value is an
-	 *         associative array containing `'type'` and `'text'` keys.
-	 */
-	protected static function _params(array $params) {
-		$result = array();
-		foreach ($params as $param) {
-			$param = explode(' ', $param, 3);
-			$type = $name = $text = null;
-
-			foreach (array('type', 'name', 'text') as $i => $key) {
-				if (!isset($param[$i])) {
-					break;
-				}
-				${$key} = $param[$i];
-			}
-			if ($name) {
-				$result[$name] = compact('type', 'text');
-			}
-		}
-		return $result;
-	}
-}
-
-?>

+ 0 - 590
frameworks/PHP/php-lithium/libraries/lithium/analysis/Inspector.php

@@ -1,590 +0,0 @@
-<?php
-/**
- * Lithium: the most rad php framework
- *
- * @copyright     Copyright 2012, Union of RAD (http://union-of-rad.org)
- * @license       http://opensource.org/licenses/bsd-license.php The BSD License
- */
-
-namespace lithium\analysis;
-
-use Exception;
-use ReflectionClass;
-use ReflectionProperty;
-use ReflectionException;
-use SplFileObject;
-use lithium\core\Libraries;
-
-/**
- * General source code inspector.
- *
- * This inspector provides a simple interface to the PHP Reflection API that
- * can be used to gather information about any PHP source file for purposes of
- * test metrics or static analysis.
- */
-class Inspector extends \lithium\core\StaticObject {
-
-	/**
-	 * classes used
-	 *
-	 * @var array
-	 */
-	protected static $_classes = array(
-		'collection' => 'lithium\util\Collection'
-	);
-
-	/**
-	 * Maps reflect method names to result array keys.
-	 *
-	 * @var array
-	 */
-	protected static $_methodMap = array(
-		'name'      => 'getName',
-		'start'     => 'getStartLine',
-		'end'       => 'getEndLine',
-		'file'      => 'getFileName',
-		'comment'   => 'getDocComment',
-		'namespace' => 'getNamespaceName',
-		'shortName' => 'getShortName'
-	);
-
-	/**
-	 * Will determine if a method can be called.
-	 *
-	 * @param  string|object $class      Class to inspect.
-	 * @param  string        $method     Method name.
-	 * @param  bool          $internal   Interal call or not.
-	 * @return bool
-	 */
-	public static function isCallable($object, $method, $internal = false) {
-		$methodExists = method_exists($object, $method);
-		$callable = function($object, $method) {
-			return is_callable(array($object, $method));
-		};
-		return $internal ? $methodExists : $methodExists && $callable($object, $method);
-	}
-
-	/**
-	 * Determines if a given $identifier is a class property, a class method, a class itself,
-	 * or a namespace identifier.
-	 *
-	 * @param string $identifier The identifier to be analyzed
-	 * @return string Identifier type. One of `property`, `method`, `class` or `namespace`.
-	 */
-	public static function type($identifier) {
-		$identifier = ltrim($identifier, '\\');
-
-		if (strpos($identifier, '::')) {
-			return (strpos($identifier, '$') !== false) ? 'property' : 'method';
-		}
-		if (is_readable(Libraries::path($identifier))) {
-			if (class_exists($identifier) && in_array($identifier, get_declared_classes())) {
-				return 'class';
-			}
-		}
-		return 'namespace';
-	}
-
-	/**
-	 * Detailed source code identifier analysis
-	 *
-	 * Analyzes a passed $identifier for more detailed information such
-	 * as method/property modifiers (e.g. `public`, `private`, `abstract`)
-	 *
-	 * @param string $identifier The identifier to be analyzed
-	 * @param array $info Optionally restrict or expand the default information
-	 *        returned from the `info` method. By default, the information returned
-	 *        is the same as the array keys contained in the `$_methodMap` property of
-	 *        Inspector.
-	 * @return array An array of the parsed meta-data information of the given identifier.
-	 */
-	public static function info($identifier, $info = array()) {
-		$info = $info ?: array_keys(static::$_methodMap);
-		$type = static::type($identifier);
-		$result = array();
-		$class = null;
-
-		if ($type === 'method' || $type === 'property') {
-			list($class, $identifier) = explode('::', $identifier);
-
-			try {
-				$classInspector = new ReflectionClass($class);
-			} catch (Exception $e) {
-				return null;
-			}
-
-			if ($type === 'property') {
-				$identifier = substr($identifier, 1);
-				$accessor = 'getProperty';
-			} else {
-				$identifier = str_replace('()', '', $identifier);
-				$accessor = 'getMethod';
-			}
-
-			try {
-				$inspector = $classInspector->{$accessor}($identifier);
-			} catch (Exception $e) {
-				return null;
-			}
-			$result['modifiers'] = static::_modifiers($inspector);
-		} elseif ($type === 'class') {
-			$inspector = new ReflectionClass($identifier);
-		} else {
-			return null;
-		}
-
-		foreach ($info as $key) {
-			if (!isset(static::$_methodMap[$key])) {
-				continue;
-			}
-			if (method_exists($inspector, static::$_methodMap[$key])) {
-				$setAccess = (
-					($type === 'method' || $type === 'property') &&
-					array_intersect($result['modifiers'], array('private', 'protected')) != array()
-					&& method_exists($inspector, 'setAccessible')
-				);
-
-				if ($setAccess) {
-					$inspector->setAccessible(true);
-				}
-				$result[$key] = $inspector->{static::$_methodMap[$key]}();
-
-				if ($setAccess) {
-					$inspector->setAccessible(false);
-					$setAccess = false;
-				}
-			}
-		}
-
-		if ($type === 'property' && !$classInspector->isAbstract()) {
-			$inspector->setAccessible(true);
-
-			try {
-				$result['value'] = $inspector->getValue(static::_class($class));
-			} catch (Exception $e) {
-				return null;
-			}
-		}
-
-		if (isset($result['start']) && isset($result['end'])) {
-			$result['length'] = $result['end'] - $result['start'];
-		}
-		if (isset($result['comment'])) {
-			$result += Docblock::comment($result['comment']);
-		}
-		return $result;
-	}
-
-	/**
-	 * Gets the executable lines of a class, by examining the start and end lines of each method.
-	 *
-	 * @param mixed $class Class name as a string or object instance.
-	 * @param array $options Set of options:
-	 *        - `'self'` _boolean_: If `true` (default), only returns lines of methods defined in
-	 *          `$class`, excluding methods from inherited classes.
-	 *        - `'methods'` _array_: An arbitrary list of methods to search, as a string (single
-	 *          method name) or array of method names.
-	 *        - `'filter'` _boolean_: If `true`, filters out lines containing only whitespace or
-	 *          braces. Note: for some reason, the Zend engine does not report `switch` and `try`
-	 *          statements as executable lines, as well as parts of multi-line assignment
-	 *          statements, so they are filtered out as well.
-	 * @return array Returns an array of the executable line numbers of the class.
-	 */
-	public static function executable($class, array $options = array()) {
-		$defaults = array(
-			'self' => true,
-			'filter' => true,
-			'methods' => array(),
-			'empty' => array(' ', "\t", '}', ')', ';'),
-			'pattern' => null,
-			'blockOpeners' => array('switch (', 'try {', '} else {', 'do {', '} while')
-		);
-		$options += $defaults;
-
-		if (empty($options['pattern']) && $options['filter']) {
-			$pattern = str_replace(' ', '\s*', join('|', array_map(
-				function($str) { return preg_quote($str, '/'); },
-				$options['blockOpeners']
-			)));
-			$pattern = join('|', array(
-				"({$pattern})",
-				"\\$(.+)\($",
-				"\s*['\"]\w+['\"]\s*=>\s*.+[\{\(]$",
-				"\s*['\"]\w+['\"]\s*=>\s*['\"]*.+['\"]*\s*"
-			));
-			$options['pattern'] = "/^({$pattern})/";
-		}
-
-		if (!$class instanceof ReflectionClass) {
-			$class = new ReflectionClass(is_object($class) ? get_class($class) : $class);
-		}
-		$options += array('group' => false);
-		$result = array_filter(static::methods($class, 'ranges', $options));
-
-		if ($options['filter'] && $class->getFileName() && $result) {
-			$lines = static::lines($class->getFileName(), $result);
-			$start = key($lines);
-
-			$code = implode("\n", $lines);
-			$tokens = token_get_all('<' . '?php' . $code);
-			$tmp = array();
-
-			foreach ($tokens as $token) {
-				if (is_array($token)) {
-					if (!in_array($token[0], array(T_COMMENT, T_DOC_COMMENT, T_WHITESPACE))) {
-						$tmp[] = $token[2];
-					}
-				}
-			}
-
-			$filteredLines = array_values(array_map(
-				function($ln) use ($start) { return $ln + $start - 1; },
-				array_unique($tmp))
-			);
-
-			$lines = array_intersect_key($lines, array_flip($filteredLines));
-
-			$result = array_keys(array_filter($lines, function($line) use ($options) {
-				$line = trim($line);
-				$empty = preg_match($options['pattern'], $line);
-				return $empty ? false : (str_replace($options['empty'], '', $line) !== '');
-			}));
-		}
-		return $result;
-	}
-
-	/**
-	 * Returns various information on the methods of an object, in different formats.
-	 *
-	 * @param mixed $class A string class name or an object instance, from which to get methods.
-	 * @param string $format The type and format of data to return. Available options are:
-	 *        - `null`: Returns a `Collection` object containing a `ReflectionMethod` instance
-	 *         for each method.
-	 *        - `'extents'`: Returns a two-dimensional array with method names as keys, and
-	 *         an array with starting and ending line numbers as values.
-	 *        - `'ranges'`: Returns a two-dimensional array where each key is a method name,
-	 *         and each value is an array of line numbers which are contained in the method.
-	 * @param array $options
-	 * @return mixed array|null|object
-	 */
-	public static function methods($class, $format = null, array $options = array()) {
-		$defaults = array('methods' => array(), 'group' => true, 'self' => true);
-		$options += $defaults;
-
-		if (!(is_object($class) && $class instanceof ReflectionClass)) {
-			try {
-				$class = new ReflectionClass($class);
-			} catch (ReflectionException $e) {
-				return null;
-			}
-		}
-		$options += array('names' => $options['methods']);
-		$methods = static::_items($class, 'getMethods', $options);
-		$result = array();
-
-		switch ($format) {
-			case null:
-				return $methods;
-			case 'extents':
-				if ($methods->getName() == array()) {
-					return array();
-				}
-
-				$extents = function($start, $end) { return array($start, $end); };
-				$result = array_combine($methods->getName(), array_map(
-					$extents, $methods->getStartLine(), $methods->getEndLine()
-				));
-			break;
-			case 'ranges':
-				$ranges = function($lines) {
-					list($start, $end) = $lines;
-					return ($end <= $start + 1) ? array() : range($start + 1, $end - 1);
-				};
-				$result = array_map($ranges, static::methods(
-					$class, 'extents', array('group' => true) + $options
-				));
-			break;
-		}
-
-		if ($options['group']) {
-			return $result;
-		}
-		$tmp = $result;
-		$result = array();
-
-		array_map(function($ln) use (&$result) { $result = array_merge($result, $ln); }, $tmp);
-		return $result;
-	}
-
-	/**
-	 * Returns various information on the properties of an object.
-	 *
-	 * @param mixed $class A string class name or an object instance, from which to get methods.
-	 * @param array $options Set of options:
-	 *        -'self': If true (default), only returns properties defined in `$class`,
-	 *         excluding properties from inherited classes.
-	 * @return mixed object lithium\analysis\Inspector._items.map|null
-	 */
-	public static function properties($class, array $options = array()) {
-		$defaults = array('properties' => array(), 'self' => true);
-		$options += $defaults;
-
-		if (!(is_object($class) && $class instanceof ReflectionClass)) {
-			try {
-				$class = new ReflectionClass($class);
-			} catch (ReflectionException $e) {
-				return null;
-			}
-		}
-		$options += array('names' => $options['properties']);
-
-		return static::_items($class, 'getProperties', $options)->map(function($item) {
-			$class = __CLASS__;
-			$modifiers = array_values($class::invokeMethod('_modifiers', array($item)));
-			$setAccess = (
-				array_intersect($modifiers, array('private', 'protected')) != array()
-			);
-			if ($setAccess) {
-				$item->setAccessible(true);
-			}
-			$result = compact('modifiers') + array(
-				'docComment' => $item->getDocComment(),
-				'name' => $item->getName(),
-				'value' => $item->getValue($item->getDeclaringClass())
-			);
-			if ($setAccess) {
-				$item->setAccessible(false);
-			}
-			return $result;
-		}, array('collect' => false));
-	}
-
-	/**
-	 * Returns an array of lines from a file, class, or arbitrary string, where $data is the data
-	 * to read the lines from and $lines is an array of line numbers specifying which lines should
-	 * be read.
-	 *
-	 * @param string $data If `$data` contains newlines, it will be read from directly, and have
-	 *        its own lines returned.  If `$data` is a physical file path, that file will be
-	 *        read and have its lines returned.  If `$data` is a class name, it will be
-	 *        converted into a physical file path and read.
-	 * @param array $lines The array of lines to read. If a given line is not present in the data,
-	 *        it will be silently ignored.
-	 * @return array Returns an array where the keys are matching `$lines`, and the values are the
-	 *         corresponding line numbers in `$data`.
-	 * @todo Add an $options parameter with a 'context' flag, to pull in n lines of context.
-	 */
-	public static function lines($data, $lines) {
-		$c = array();
-
-		if (strpos($data, PHP_EOL) !== false) {
-			$c = explode(PHP_EOL, PHP_EOL . $data);
-		} else {
-			if (!file_exists($data)) {
-				$data = Libraries::path($data);
-				if (!file_exists($data)) {
-					return null;
-				}
-			}
-
-			$file = new SplFileObject($data);
-			foreach ($file as $current) {
-				$c[$file->key() + 1] = rtrim($file->current());
-			}
-		}
-
-		if (!count($c) || !count($lines)) {
-			return null;
-		}
-		return array_intersect_key($c, array_combine($lines, array_fill(0, count($lines), null)));
-	}
-
-	/**
-	 * Gets the full inheritance list for the given class.
-	 *
-	 * @param string $class Class whose inheritance chain will be returned
-	 * @param array $options Option consists of:
-	 *        - `'autoLoad'` _boolean_: Whether or not to call `__autoload` by default. Defaults
-	 *          to `true`.
-	 * @return array An array of the name of the parent classes of the passed `$class` parameter,
-	 *         or `false` on error.
-	 * @link http://php.net/manual/en/function.class-parents.php PHP Manual: `class_parents()`.
-	 */
-	public static function parents($class, array $options = array()) {
-		$defaults = array('autoLoad' => false);
-		$options += $defaults;
-		$class = is_object($class) ? get_class($class) : $class;
-
-		if (!class_exists($class, $options['autoLoad'])) {
-			return false;
-		}
-		return class_parents($class);
-	}
-
-	/**
-	 * Gets an array of classes and their corresponding definition files, or examines a file and
-	 * returns the classes it defines.
-	 *
-	 * @param array $options
-	 * @return array Associative of classes and their corresponding definition files
-	 * @todo Document valid options
-	 */
-	public static function classes(array $options = array()) {
-		$defaults = array('group' => 'classes', 'file' => null);
-		$options += $defaults;
-
-		$list = get_declared_classes();
-		$files = get_included_files();
-		$classes = array();
-
-		if ($file = $options['file']) {
-			$loaded = static::_instance('collection', array('data' => array_map(
-				function($class) { return new ReflectionClass($class); }, $list
-			)));
-			$classFiles = $loaded->getFileName();
-
-			if (in_array($file, $files) && !in_array($file, $classFiles)) {
-				return array();
-			}
-			if (!in_array($file, $classFiles)) {
-				include $file;
-				$list = array_diff(get_declared_classes(), $list);
-			} else {
-				$filter = function($class) use ($file) { return $class->getFileName() === $file; };
-				$list = $loaded->find($filter)->map(function ($class) {
-					return $class->getName() ?: $class->name;
-				}, array('collect' => false));
-			}
-		}
-
-		foreach ($list as $class) {
-			$inspector = new ReflectionClass($class);
-
-			if ($options['group'] === 'classes') {
-				$inspector->getFileName() ? $classes[$class] = $inspector->getFileName() : null;
-			} elseif ($options['group'] === 'files') {
-				$classes[$inspector->getFileName()][] = $inspector;
-			}
-		}
-		return $classes;
-	}
-
-	/**
-	 * Gets the static and dynamic dependencies for a class or group of classes.
-	 *
-	 * @param mixed $classes Either a string specifying a class, or a numerically indexed array
-	 *        of classes
-	 * @param array $options
-	 * @return array An array of the static and dynamic class dependencies
-	 * @todo Document valid options
-	 */
-	public static function dependencies($classes, array $options = array()) {
-		$defaults = array('type' => null);
-		$options += $defaults;
-		$static = $dynamic = array();
-		$trim = function($c) { return trim(trim($c, '\\')); };
-		$join = function ($i) { return join('', $i); };
-
-		foreach ((array) $classes as $class) {
-			$data = explode("\n", file_get_contents(Libraries::path($class)));
-			$data = "<?php \n" . join("\n", preg_grep('/^\s*use /', $data)) . "\n ?>";
-
-			$classes = array_map($join, Parser::find($data, 'use *;', array(
-				'return'      => 'content',
-				'lineBreaks'  => true,
-				'startOfLine' => true,
-				'capture'     => array('T_STRING', 'T_NS_SEPARATOR')
-			)));
-
-			if ($classes) {
-				$static = array_unique(array_merge($static, array_map($trim, $classes)));
-			}
-			$classes = static::info($class . '::$_classes', array('value'));
-
-			if (isset($classes['value'])) {
-				$dynamic = array_merge($dynamic, array_map($trim, array_values($classes['value'])));
-			}
-		}
-
-		if (empty($options['type'])) {
-			return array_unique(array_merge($static, $dynamic));
-		}
-		$type = $options['type'];
-		return isset(${$type}) ? ${$type} : null;
-	}
-
-	/**
-	 * Returns an instance of the given class without directly instantiating it. Inspired by the
-	 * work of Sebastian Bergmann on the PHP Object Freezer project.
-	 *
-	 * @link http://sebastian-bergmann.de/archives/831-Freezing-and-Thawing-PHP-Objects.html
-	 *       Freezing and Thawing PHP Objects
-	 * @param string $class The name of the class to return an instance of.
-	 * @return object Returns an instance of the object given by `$class` without calling that
-	 *        class' constructor.
-	 */
-	protected static function _class($class) {
-		if (!class_exists($class)) {
-			throw new RuntimeException(sprintf('Class `%s` could not be found.', $class));
-		}
-		return unserialize(sprintf('O:%d:"%s":0:{}', strlen($class), $class));
-	}
-
-	/**
-	 * Helper method to get an array of `ReflectionMethod` or `ReflectionProperty` objects, wrapped
-	 * in a `Collection` object, and filtered based on a set of options.
-	 *
-	 * @param ReflectionClass $class A reflection class instance from which to fetch.
-	 * @param string $method A getter method to call on the `ReflectionClass` instance, which will
-	 *               return an array of items, i.e. `'getProperties'` or `'getMethods'`.
-	 * @param array $options The options used to filter the resulting method list.
-	 * @return object Returns a `Collection` object instance containing the results of the items
-	 *         returned from the call to the method specified in `$method`, after being passed
-	 *         through the filters specified in `$options`.
-	 */
-	protected static function _items($class, $method, $options) {
-		$defaults = array('names' => array(), 'self' => true, 'public' => true);
-		$options += $defaults;
-
-		$params = array(
-			'getProperties' => ReflectionProperty::IS_PUBLIC | (
-				$options['public'] ? 0 : ReflectionProperty::IS_PROTECTED
-			)
-		);
-		$data = isset($params[$method]) ? $class->{$method}($params[$method]) : $class->{$method}();
-
-		if (!empty($options['names'])) {
-			$data = array_filter($data, function($item) use ($options) {
-				return in_array($item->getName(), (array) $options['names']);
-			});
-		}
-
-		if ($options['self']) {
-			$data = array_filter($data, function($item) use ($class) {
-				return ($item->getDeclaringClass()->getName() === $class->getName());
-			});
-		}
-
-		if ($options['public']) {
-			$data = array_filter($data, function($item) { return $item->isPublic(); });
-		}
-		return static::_instance('collection', compact('data'));
-	}
-
-	/**
-	 * Helper method to determine if a class applies to a list of modifiers.
-	 *
-	 * @param string $inspector ReflectionClass instance.
-	 * @param array|string $list List of modifiers to test.
-	 * @return boolean Test result.
-	 */
-	protected static function _modifiers($inspector, $list = array()) {
-		$list = $list ?: array('public', 'private', 'protected', 'abstract', 'final', 'static');
-		return array_filter($list, function($modifier) use ($inspector) {
-			$method = 'is' . ucfirst($modifier);
-			return (method_exists($inspector, $method) && $inspector->{$method}());
-		});
-	}
-}
-
-?>

+ 0 - 196
frameworks/PHP/php-lithium/libraries/lithium/analysis/Logger.php

@@ -1,196 +0,0 @@
-<?php
-/**
- * Lithium: the most rad php framework
- *
- * @copyright     Copyright 2012, Union of RAD (http://union-of-rad.org)
- * @license       http://opensource.org/licenses/bsd-license.php The BSD License
- */
-
-namespace lithium\analysis;
-
-use UnexpectedValueException;
-
-/**
- * The `Logger` class provides a consistent, application-wide interface for configuring and writing
- * log messages. As with other subclasses of `Adaptable`, `Logger` can be configured with a series
- * of named configurations, each containing a log adapter to write to. `Logger` exposes a single
- * method, `write()`, which can write to one or more log adapters.
- *
- * When configuring adapters, you may specify one or more priorities for each, using the
- * `'priority'` key. This key can be a single priority level (string), or an array of multiple
- * levels. When a log message is written, all adapters that are configured to accept the priority
- * level with which the message was written will receive the message.
- *
- * {{{
- * Logger::config(array(
- * 	'default' => array('adapter' => 'Syslog'),
- * 	'badnews' => array(
- * 		'adapter' => 'File',
- * 		'priority' => array('emergency', 'alert', 'critical', 'error')
- * 	)
- * ));
- * }}}
- *
- * In the above configuration, all messages will be written to the system log (`syslogd`), but only
- * messages with the priority `error` or higher will be logged to a file. Messages can then be
- * written to the log(s) using the `write()` method:
- *
- * {{{ Logger::write('alert', 'This is an alert-level message that will be logged in 2 places'); }}}
- *
- * Messages can also be written using the log priority as a method name:
- *
- * {{{ Logger::alert('This is an alert-level message that will be logged in 2 places'); }}}
- *
- * This works identically to the above. The message priority levels which `Logger` supports are as
- * follows: `emergency`, `alert`, `critical`, `error`, `warning`, `notice`, `info` and `debug`.
- * Attempting to use any other priority level will raise an exception. See the list of available
- * adapters for more information on what adapters are available, and how to configure them.
- *
- * @see lithium\analysis\logger\adapter
- */
-class Logger extends \lithium\core\Adaptable {
-
-	/**
-	 * Stores configurations for cache adapters.
-	 *
-	 * @var object `Collection` of logger configurations.
-	 */
-	protected static $_configurations = array();
-
-	/**
-	 * Libraries::locate() compatible path to adapters for this class.
-	 *
-	 * @see lithium\core\Libraries::locate()
-	 * @var string Dot-delimited path.
-	 */
-	protected static $_adapters = 'adapter.analysis.logger';
-
-	/**
-	 * An array of valid message priorities.
-	 *
-	 * @var array
-	 */
-	protected static $_priorities = array(
-		'emergency' => 0,
-		'alert'     => 1,
-		'critical'  => 2,
-		'error'     => 3,
-		'warning'   => 4,
-		'notice'    => 5,
-		'info'      => 6,
-		'debug'     => 7
-	);
-
-	/**
-	 * Writes a message to one or more log adapters, where the adapters that are written to are the
-	 * ones that respond to the given priority level.
-	 *
-	 * @param string $priority The priority of the log message to be written.
-	 * @param string $message The message to be written.
-	 * @param array $options An array of adapter-specific options that may be passed when writing
-	 *              log messages. Some options are also handled by `Logger` itself:
-	 *              - `'name'` _string_: This option can be specified if you wish to write to a
-	 *                specific adapter configuration, instead of writing to the adapter(s) that
-	 *                respond to the given priority.
-	 * @return boolean Returns `true` if all log writes succeeded, or `false` if _any or all_ writes
-	 *         failed.
-	 * @throws UnexpectedValueException If the value of `$priority` is not a defined priority value,
-	 *         an `UnexpectedValueException` will be thrown.
-	 * @filter
-	 */
-	public static function write($priority, $message, array $options = array()) {
-		$defaults = array('name' => null);
-		$options += $defaults;
-		$result = true;
-
-		if (isset(self::$_configurations[$options['name']])) {
-			$name = $options['name'];
-			$methods = array($name => static::adapter($name)->write($priority, $message, $options));
-		} elseif (!isset(static::$_priorities[$priority])) {
-			$message = "Attempted to write log message with invalid priority `{$priority}`.";
-			throw new UnexpectedValueException($message);
-		} else {
-			$methods = static::_configsByPriority($priority, $message, $options);
-		}
-
-		foreach ($methods as $name => $method) {
-			$params = compact('priority', 'message', 'options');
-			$config = static::_config($name);
-			$result &= static::_filter(__FUNCTION__, $params, $method, $config['filters']);
-		}
-		return $methods ? $result : false;
-	}
-
-	/**
-	 * Acts as a proxy for the `write()` method, allowing log message priority names to be called as
-	 * methods, i.e.:
-	 * {{{
-	 * Logger::emergency('Something bad happened.');
-	 * // This is equivalent to Logger::write('emergency', 'Something bad happened')
-	 * }}}
-	 *
-	 * @param string $priority The name of the method called on the `Logger` class. This should map
-	 *               to a log type.
-	 * @param array $params An array of parameters passed in the method.
-	 * @return boolean Returns `true` or `false`, depending on the success of the `write()` method.
-	 */
-	public static function __callStatic($priority, $params) {
-		$params += array(null, array());
-		return static::write($priority, $params[0], $params[1]);
-	}
-
-	/**
-	 * Custom check to determine if our given magic methods can be responded to.
-	 *
-	 * @param  string  $method     Method name.
-	 * @param  bool    $internal   Interal call or not.
-	 * @return bool
-	 */
-	public static function respondsTo($method, $internal = false) {
-		return isset(static::$_priorities[$method]) || parent::respondsTo($method, $internal);
-	}
-
-	/**
-	 * This method is called automatically to initialize the default configuration of a log adapter,
-	 * such that the adapter defaults to accepting log messages of any priority (i.e. the
-	 * `'priority'` key is set to `true`).
-	 *
-	 * @param string $name The name of the logger configuration.
-	 * @param array $config The logger configuration as specified in application code.
-	 * @return array Returns an array of configuration data, merged with default values.
-	 */
-	protected static function _initConfig($name, $config) {
-		$defaults = array('priority' => true);
-		return parent::_initConfig($name, $config) + $defaults;
-	}
-
-	/**
-	 * Gets the names of the adapter configurations that respond to a specific priority. The list
-	 * of adapter configurations returned will be used to write a message with the given priority.
-	 *
-	 * @param string $priority The priority level of a message to be written.
-	 * @param string $message The message to write to the adapter.
-	 * @param array $options Adapter-specific options.
-	 * @return array Returns an array of names of configurations which are set up to respond to the
-	 *         message priority specified in `$priority`, or configured to respond to _all_ message
-	 *        priorities.
-	 */
-	protected static function _configsByPriority($priority, $message, array $options = array()) {
-		$configs = array();
-		$key = 'priority';
-
-		foreach (array_keys(static::$_configurations) as $name) {
-			$config = static::config($name);
-			$nameMatch = ($config[$key] === true || $config[$key] === $priority);
-			$arrayMatch = (is_array($config[$key]) && in_array($priority, $config[$key]));
-
-			if ($nameMatch || $arrayMatch) {
-				$method = static::adapter($name)->write($priority, $message, $options);
-				$method ? $configs[$name] = $method : null;
-			}
-		}
-		return $configs;
-	}
-}
-
-?>

+ 0 - 315
frameworks/PHP/php-lithium/libraries/lithium/analysis/Parser.php

@@ -1,315 +0,0 @@
-<?php
-/**
- * Lithium: the most rad php framework
- *
- * @copyright     Copyright 2012, Union of RAD (http://union-of-rad.org)
- * @license       http://opensource.org/licenses/bsd-license.php The BSD License
- */
-
-namespace lithium\analysis;
-
-use lithium\util\Set;
-use lithium\util\Collection;
-
-/**
- * The parser class uses PHP's tokenizer to provide methods and tools for performing static analysis
- * on PHP code.
- */
-class Parser extends \lithium\core\StaticObject {
-
-	/**
-	 * Convenience method to get the token name of a PHP code string. If multiple tokens are
-	 * present in the string, only the first is returned.
-	 *
-	 * @param string $string String of PHP code to get the token name of, i.e. `'=>'` or `'static'`.
-	 * @param array $options
-	 * @return mixed
-	 */
-	public static function token($string, array $options = array()) {
-		$defaults = array('id' => false);
-		$options += $defaults;
-
-		if (empty($string) && $string !== '0') {
-			return false;
-		}
-		list($token) = static::tokenize($string);
-		return $token[($options['id']) ? 'id' : 'name'];
-	}
-
-	/**
-	 * Splits the provided `$code` into PHP language tokens.
-	 *
-	 * @param string $code Source code to be tokenized.
-	 * @param array $options Options consists of:
-	 *        -'wrap': Boolean indicating whether or not to wrap the supplied
-	 *          code in PHP tags.
-	 *        -'ignore': An array containing PHP language tokens to ignore.
-	 *        -'include': If supplied, an array of the only language tokens
-	 *         to include in the output.
-	 * @return array An array of tokens in the supplied source code.
-	 */
-	public static function tokenize($code, array $options = array()) {
-		$defaults = array('wrap' => true, 'ignore' => array(), 'include' => array());
-		$options += $defaults;
-		$tokens = array();
-		$line = 1;
-
-		if ($options['wrap']) {
-			$code = "<?php {$code}?>";
-		}
-		foreach (token_get_all($code) as $token) {
-			$token = (isset($token[1])) ? $token : array(null, $token, $line);
-			list($id, $content, $line) = $token;
-			$name = $id ? token_name($id) : $content;
-
-			if (!empty($options['include'])) {
-				if (!in_array($name, $options['include']) && !in_array($id, $options['include'])) {
-					continue;
-				}
-			}
-
-			if (!empty($options['ignore'])) {
-				if (in_array($name, $options['ignore']) || in_array($id, $options['ignore'])) {
-					continue;
-				}
-			}
-			$tokens[] = array('id' => $id, 'name' => $name, 'content' => $content, 'line' => $line);
-
-			$line += count(preg_split('/\r\n|\r|\n/', $content)) - 1;
-		}
-
-		if ($options['wrap'] && empty($options['include'])) {
-			$tokens = array_slice($tokens, 1, count($tokens) - 2);
-		}
-		return $tokens;
-	}
-
-	/**
-	 * Finds a pattern in a block of code.
-	 *
-	 * @param string $code
-	 * @param string $pattern
-	 * @param array $options The list of options to be used when parsing / matching `$code`:
-	 *              - 'ignore': An array of token names to ignore while parsing, defaults to
-	 *               `array('T_WHITESPACE')`
-	 *              - 'lineBreaks': If true, all tokens in a single pattern match must appear on the
-	 *                same line of code, defaults to false
-	 *              - 'startOfLine': If true, the pattern must match starting with the beginning of
-	 *                the line of code to be matched, defaults to false
-	 * @return array
-	 */
-	public static function find($code, $pattern, array $options = array()) {
-		$defaults = array(
-			'all' => true, 'capture' => array(), 'ignore' => array('T_WHITESPACE'),
-			'return' => true, 'lineBreaks' => false, 'startOfLine' => false
-		);
-		$options += $defaults;
-		$results = array();
-		$matches = array();
-		$patternMatch = array();
-		$ret = $options['return'];
-
-		$tokens = new Collection(array('data' => static::tokenize($code, $options)));
-		$pattern = new Collection(array('data' => static::tokenize($pattern, $options)));
-
-		$breaks = function($token) use (&$tokens, &$matches, &$patternMatch, $options) {
-			if (!$options['lineBreaks']) {
-				return true;
-			}
-			if (empty($patternMatch) && !$options['startOfLine']) {
-				return true;
-			}
-
-			if (empty($patternMatch)) {
-				$prev = $tokens->prev();
-				$tokens->next();
-			} else {
-				$prev = reset($patternMatch);
-			}
-
-			if (empty($patternMatch) && $options['startOfLine']) {
-				return ($token['line'] > $prev['line']);
-			}
-			return ($token['line'] == $prev['line']);
-		};
-
-		$capture = function($token) use (&$matches, &$patternMatch, $tokens, $breaks, $options) {
-			if (is_null($token)) {
-				$matches = $patternMatch = array();
-				return false;
-			}
-
-			if (empty($patternMatch)) {
-				$prev = $tokens->prev();
-				$tokens->next();
-				if ($options['startOfLine'] && $token['line'] == $prev['line']) {
-					$patternMatch = $matches = array();
-					return false;
-				}
-			}
-			$patternMatch[] = $token;
-
-			if (empty($options['capture']) || !in_array($token['name'], $options['capture'])) {
-				return true;
-			}
-			if (!$breaks($token)) {
-				$matches = array();
-				return true;
-			}
-			$matches[] = $token;
-			return true;
-		};
-
-		$executors = array(
-			'*' => function(&$tokens, &$pattern) use ($options, $capture) {
-				$closing = $pattern->next();
-				$tokens->prev();
-
-				while (($t = $tokens->next()) && !Parser::matchToken($closing, $t)) {
-					$capture($t);
-				}
-				$pattern->next();
-			}
-		);
-
-		$tokens->rewind();
-		$pattern->rewind();
-
-		while ($tokens->valid()) {
-			if (!$pattern->valid()) {
-				$pattern->rewind();
-
-				if (!empty($matches)) {
-					$results[] = array_map(
-						function($i) use ($ret) { return isset($i[$ret]) ? $i[$ret] : $i; },
-						$matches
-					);
-				}
-				$capture(null);
-			}
-
-			$p = $pattern->current();
-			$t = $tokens->current();
-
-			switch (true) {
-				case (static::matchToken($p, $t)):
-					$capture($t) ? $pattern->next() : $pattern->rewind();
-				break;
-				case (isset($executors[$p['name']])):
-					$exec = $executors[$p['name']];
-					$exec($tokens, $pattern);
-				break;
-				default:
-					$capture(null);
-					$pattern->rewind();
-				break;
-			}
-			$tokens->next();
-		}
-		return $results;
-	}
-
-	/**
-	 * Token pattern matching.
-	 *
-	 * @param string $code Source code to be analyzed.
-	 * @param string $parameters An array containing token patterns to be matched.
-	 * @param array $options The list of options to be used when matching `$code`:
-	 *              - 'ignore': An array of language tokens to ignore.
-	 *              - 'return': If set to 'content' returns an array of matching tokens.
-	 * @return array Array of matching tokens.
-	 */
-	public static function match($code, $parameters, array $options = array()) {
-		$defaults = array('ignore' => array('T_WHITESPACE'), 'return' => true);
-		$options += $defaults;
-		$parameters = static::_prepareMatchParams($parameters);
-
-		$tokens = is_array($code) ? $code : static::tokenize($code, $options);
-		$results = array();
-
-		foreach ($tokens as $i => $token) {
-			if (!array_key_exists($token['name'], $parameters)) {
-				if (!in_array('*', $parameters)) {
-					continue;
-				}
-			}
-			$param = $parameters[$token['name']];
-
-			if (isset($param['before']) && $i > 0) {
-				if (!in_array($tokens[$i - 1]['name'], (array) $param['before'])) {
-					continue;
-				}
-			}
-
-			if (isset($param['after']) && $i + 1 < count($tokens)) {
-				 if (!in_array($tokens[$i + 1]['name'], (array) $param['after'])) {
-					continue;
-				}
-			}
-			$results[] = isset($token[$options['return']]) ? $token[$options['return']] : $token;
-		}
-		return $results;
-	}
-
-	/**
-	 * Compares two PHP language tokens.
-	 *
-	 * @param array $pattern Pattern token.
-	 * @param array $token Token to be compared.
-	 * @return boolean Match result.
-	 */
-	public static function matchToken($pattern, $token) {
-		if ($pattern['name'] != $token['name']) {
-			return false;
-		}
-
-		if (!isset($pattern['content'])) {
-			return true;
-		}
-
-		$match = $pattern['content'];
-		$content = $token['content'];
-
-		if ($pattern['name'] === 'T_VARIABLE') {
-			$match = substr($match, 1);
-			$content = substr($content, 1);
-		}
-
-		switch (true) {
-			case ($match === '_' || $match == $content):
-				return true;
-		}
-		return false;
-	}
-
-	/**
-	 * Helper function to normalize parameters for token matching.
-	 *
-	 * @see lithium\analysis\Parser::match()
-	 * @param array $parameters Params to be normalized.
-	 * @return array Normalized parameters.
-	 */
-	protected static function _prepareMatchParams($parameters) {
-		foreach (Set::normalize($parameters) as $token => $scope) {
-			if (strpos($token, 'T_') !== 0) {
-				unset($parameters[$token]);
-
-				foreach (array('before', 'after') as $key) {
-					if (!isset($scope[$key])) {
-						continue;
-					}
-					$items = array();
-
-					foreach ((array) $scope[$key] as $item) {
-						$items[] = (strpos($item, 'T_') !== 0)  ? static::token($item) : $item;
-					}
-					$scope[$key] = $items;
-				}
-				$parameters[static::token($token)] = $scope;
-			}
-		}
-		return $parameters;
-	}
-}
-
-?>

+ 0 - 81
frameworks/PHP/php-lithium/libraries/lithium/analysis/logger/adapter/Cache.php

@@ -1,81 +0,0 @@
-<?php
-/**
- * Lithium: the most rad php framework
- *
- * @copyright     Copyright 2012, Union of RAD (http://union-of-rad.org)
- * @license       http://opensource.org/licenses/bsd-license.php The BSD License
- */
-
-namespace lithium\analysis\logger\adapter;
-
-use lithium\util\String;
-
-/**
- * The `Cache` logger allows log messages to be written to cache configurations set up in
- * `lithium\storage\Cache`. In order to use this adapter, you must first configure a cache adapter
- * for it to write to, as follows:
- *
- * {{{ lithium\storage\Cache::config(array(
- * 	'storage' => array('adapter' => 'Redis', 'host' => '127.0.0.1:6379')
- * ));}}}
- *
- * Then, you can configure the `Cache` logger with the `'storage'` config:
- * {{{ lithium\analysis\Logger::config(array(
- * 	'debug' => array('adapter' => 'Cache', 'config' => 'storage')
- * ));
- * }}}
- *
- * You can then send messages to the logger which will be written to the cache store:
- * {{{
- * lithium\analysis\Logger::write('debug', 'This message will be written to a Redis data store.');
- * }}}
- *
- * @see lithium\storage\Cache
- */
-class Cache extends \lithium\core\Object {
-
-	/**
-	 * Classes used by `Cache`.
-	 *
-	 * @var array
-	 */
-	protected $_classes = array(
-		'cache' => 'lithium\storage\Cache'
-	);
-
-	/**
-	 * Class constructor.
-	 *
-	 * @param array $config
-	 */
-	public function __construct(array $config = array()) {
-		$defaults = array(
-			'config' => null,
-			'expiry' => '+999 days',
-			'key' => 'log_{:type}_{:timestamp}'
-		);
-		parent::__construct($config + $defaults);
-	}
-
-	/**
-	 * Writes the message to the configured cache adapter.
-	 *
-	 * @param string $type
-	 * @param string $message
-	 * @return closure Function returning boolean `true` on successful write, `false` otherwise.
-	 */
-	public function write($type, $message) {
-		$config = $this->_config + $this->_classes;
-
-		return function($self, $params) use ($config) {
-			$params += array('timestamp' => strtotime('now'));
-			$key = $config['key'];
-			$key = is_callable($key) ? $key($params) : String::insert($key, $params);
-
-			$cache = $config['cache'];
-			return $cache::write($config['config'], $key, $params['message'], $config['expiry']);
-		};
-	}
-}
-
-?>

+ 0 - 83
frameworks/PHP/php-lithium/libraries/lithium/analysis/logger/adapter/File.php

@@ -1,83 +0,0 @@
-<?php
-/**
- * Lithium: the most rad php framework
- *
- * @copyright     Copyright 2012, Union of RAD (http://union-of-rad.org)
- * @license       http://opensource.org/licenses/bsd-license.php The BSD License
- */
-
-namespace lithium\analysis\logger\adapter;
-
-use lithium\util\String;
-use lithium\core\Libraries;
-
-/**
- * A simple log adapter that writes messages to files. By default, messages are written to
- * `resources/tmp/logs/<type>.log`, where `<type>` is the log message priority level.
- *
- * {{{
- * use lithium\analysis\Logger;
- *
- * Logger::config(array(
- * 	'simple' => array('adapter' => 'File')
- * ));
- * Logger::write('debug', 'Something happened!');
- * }}}
- *
- * This will cause the message and the timestamp of the log event to be written to
- * `resources/tmp/logs/debug.log`. For available configuration options for this adapter, see
- * the `__construct()` method.
- *
- * @see lithium\analysis\logger\adapter\File::__construct()
- */
-class File extends \lithium\core\Object {
-
-	/**
-	 * Class constructor.
-	 *
-	 * @see lithium\util\String::insert()
-	 * @param array $config Settings used to configure the adapter. Available options:
-	 *              - `'path'` _string_: The directory to write log files to. Defaults to
-	 *                `<app>/resources/tmp/logs`.
-	 *              - `'timestamp'` _string_: The `date()`-compatible timestamp format. Defaults to
-	 *                `'Y-m-d H:i:s'`.
-	 *              - `'file'` _closure_: A closure which accepts two parameters: an array
-	 *                containing the current log message details, and an array containing the `File`
-	 *                adapter's current configuration. It must then return a file name to write the
-	 *                log message to. The default will produce a log file name corresponding to the
-	 *                priority of the log message, i.e. `"debug.log"` or `"alert.log"`.
-	 *              - `'format'` _string_: A `String::insert()`-compatible string that specifies how
-	 *                the log message should be formatted. The default format is
-	 *                `"{:timestamp} {:message}\n"`.
-	 */
-	public function __construct(array $config = array()) {
-		$defaults = array(
-			'path' => Libraries::get(true, 'resources') . '/tmp/logs',
-			'timestamp' => 'Y-m-d H:i:s',
-			'file' => function($data, $config) { return "{$data['priority']}.log"; },
-			'format' => "{:timestamp} {:message}\n"
-		);
-		parent::__construct($config + $defaults);
-	}
-
-	/**
-	 * Appends a message to a log file.
-	 *
-	 * @see lithium\analysis\Logger::$_priorities
-	 * @param string $priority The message priority. See `Logger::$_priorities`.
-	 * @param string $message The message to write to the log.
-	 * @return closure Function returning boolean `true` on successful write, `false` otherwise.
-	 */
-	public function write($priority, $message) {
-		$config = $this->_config;
-
-		return function($self, $params) use (&$config) {
-			$path = $config['path'] . '/' . $config['file']($params, $config);
-			$params['timestamp'] = date($config['timestamp']);
-			$message = String::insert($config['format'], $params);
-			return file_put_contents($path, $message, FILE_APPEND);
-		};
-	}
-}
-
-?>

+ 0 - 194
frameworks/PHP/php-lithium/libraries/lithium/analysis/logger/adapter/FirePhp.php

@@ -1,194 +0,0 @@
-<?php
-/**
- * Lithium: the most rad php framework
- *
- * @copyright     Copyright 2012, Union of RAD (http://union-of-rad.org)
- * @license       http://opensource.org/licenses/bsd-license.php The BSD License
- */
-
-namespace lithium\analysis\logger\adapter;
-
-/**
- * The `FirePhp` log adapter allows you to log messages to [ FirePHP](http://www.firephp.org/).
- *
- * This allows you to inspect native PHP values and objects inside the FireBug console.
- *
- * Because this adapter interacts directly with the `Response` object, some additional code is
- * required to use it. The simplest way to achieve this is to add a filter to the `Dispatcher`. For
- * example, the following can be placed in a bootstrap file:
- *
- * {{{
- * use lithium\action\Dispatcher;
- * use lithium\analysis\Logger;
- *
- * Logger::config(array(
- * 	'default' => array('adapter' => 'FirePhp')
- * ));
- *
- * Dispatcher::applyFilter('_call', function($self, $params, $chain) {
- * 	if (isset($params['callable']->response)) {
- * 		Logger::adapter('default')->bind($params['callable']->response);
- * 	}
- * 	return $chain->next($self, $params, $chain);
- * });
- * }}}
- *
- * This will cause the message and other debug settings added to the header of the
- * response, where FirePHP is able to locate and print it accordingly. As this adapter
- * implements the protocol specification directly, you don't need another vendor library to
- * use it.
- *
- * Now, in you can use the logger in your application code (like controllers, views and models).
- *
- * {{{
- * class PagesController extends \lithium\action\Controller {
- * 	public function view() {
- * 		//...
- * 		Logger::error("Something bad happened!");
- * 		//...
- * 	}
- * }
- * }}}
- *
- * Because this adapter also has a queue implemented, it is possible to log messages even when the
- * `Response` object is not yet generated. When it gets generated (and bound), all queued messages
- * get flushed instantly.
- *
- * Because FirePHP is not a conventional logging destination like a file or a database, you can
- * pass everything (except resources) to the logger and inspect it further in FirePHP. In fact,
- * every message that is passed will be encoded via `json_encode()`, so check out this built-in
- * method for more information on how your message will be encoded.
- *
- * {{{
- * Logger::debug(array('debug' => 'me'));
- * Logger::debug(new \lithium\action\Response());
- * }}}
- *
- * @see lithium\action\Response
- * @see lithium\net\http\Message::headers()
- * @link http://www.firephp.org/ FirePHP
- * @link http://www.firephp.org/Wiki/Reference/Protocol FirePHP Protocol Reference
- * @link http://php.net/manual/en/function.json-encode.php PHP Manual: `json_encode()`
- */
-class FirePhp extends \lithium\core\Object {
-
-	/**
-	 * These headers are specified by FirePHP and get added as headers to the response.
-	 *
-	 * @var array
-	 */
-	protected $_headers = array(
-		'X-Wf-Protocol-1' => 'http://meta.wildfirehq.org/Protocol/JsonStream/0.2',
-		'X-Wf-1-Plugin-1' =>
-			'http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/0.3',
-		'X-Wf-1-Structure-1' =>
-			'http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1'
-	);
-
-	/**
-	 * This is a mapping table that maps Lithium log levels to FirePHP log levels as they
-	 * do not correlate directly and FirePHP only accepts a distinct set.
-	 *
-	 * @var array
-	 */
-	protected $_levels = array(
-		'emergency' => 'ERROR',
-		'alert'     => 'ERROR',
-		'critical'  => 'ERROR',
-		'error'     => 'ERROR',
-		'warning'   => 'WARN',
-		'notice'    => 'INFO',
-		'info'      => 'INFO',
-		'debug'     => 'LOG'
-	);
-
-	/**
-	 * This self-incrementing counter allows the user to log more than one message per request.
-	 *
-	 * @var integer
-	 */
-	protected $_counter = 1;
-
-	/**
-	 * Holds the response object where the headers will be inserted.
-	 */
-	protected $_response = null;
-
-	/**
-	 * Contains messages that have been written to the log before the bind() call.
-	 */
-	protected $_queue = array();
-
-	/**
-	 * Binds the response object to the logger and sets the required Wildfire
-	 * protocol headers.
-	 *
-	 * @param object $response An instance of a response object (usually `lithium\action\Response`)
-	 *               with HTTP request information.
-	 * @return void
-	 */
-	public function bind($response) {
-		$this->_response = $response;
-		$this->_response->headers += $this->_headers;
-
-		foreach ($this->_queue as $message) {
-			$this->_write($message);
-		}
-	}
-
-	/**
-	 * Appends a log message to the response header for FirePHP.
-	 *
-	 * @param string $priority Represents the message priority.
-	 * @param string $message Contains the actual message to store.
-	 * @return boolean Always returns `true`. Note that in order for message-writing to take effect,
-	 *                 the adapter must be bound to the `Response` object instance associated with
-	 *                 the current request. See the `bind()` method.
-	 */
-	public function write($priority, $message) {
-		$_self =& $this;
-
-		return function($self, $params) use (&$_self) {
-			$priority = $params['priority'];
-			$message = $params['message'];
-			$message = $_self->invokeMethod('_format', array($priority, $message));
-			$_self->invokeMethod('_write', array($message));
-			return true;
-		};
-	}
-
-	/**
-	 * Heper method that writes the message to the header of a bound `Response` object. If no
-	 * `Response` object is bound when this method is called, it is stored in a message queue.
-	 *
-	 * @see lithium\analysis\logger\adapter\FirePhp::_format()
-	 * @param array $message A message containing the key and the content to store.
-	 * @return void
-	 */
-	protected function _write($message) {
-		if (!$this->_response) {
-			return $this->_queue[] = $message;
-		}
-		$this->_response->headers[$message['key']] = $message['content'];
-	}
-
-	/**
-	 * Generates a string representation of the type and message, suitable for FirePHP.
-	 *
-	 * @param string $type Represents the message priority.
-	 * @param string $message Contains the actual message to store.
-	 * @return array Returns the encoded string representations of the priority and message, in the
-	 *               `'key'` and `'content'` keys, respectively.
-	 */
-	protected function _format($type, $message) {
-		$key = 'X-Wf-1-1-1-' . $this->_counter++;
-
-		$content = array(array('Type' => $this->_levels[$type]), $message);
-		$content = json_encode($content);
-		$content = strlen($content) . '|' . $content . '|';
-
-		return compact('key', 'content');
-	}
-}
-
-?>

+ 0 - 247
frameworks/PHP/php-lithium/libraries/lithium/analysis/logger/adapter/Growl.php

@@ -1,247 +0,0 @@
-<?php
-/**
- * Lithium: the most rad php framework
- *
- * @copyright     Copyright 2012, Union of RAD (http://union-of-rad.org)
- * @license       http://opensource.org/licenses/bsd-license.php The BSD License
- */
-
-namespace lithium\analysis\logger\adapter;
-
-use lithium\util\Inflector;
-use lithium\core\NetworkException;
-
-/**
- * The `Growl` logger implements support for the [ Growl](http://growl.info/) notification system
- * for Mac OS X. Writing to this logger will display small, customizable status messages on the
- * screen.
- */
-class Growl extends \lithium\core\Object {
-
-	/**
-	 * Array that maps `Logger` message priority names to Growl-compatible priority levels.
-	 *
-	 * @var array
-	 */
-	protected $_priorities = array(
-		'emergency' => 2,
-		'alert'     => 1,
-		'critical'  => 1,
-		'error'     => 1,
-		'warning'   => 0,
-		'notice'    => -1,
-		'info'      => -2,
-		'debug'     => -2
-	);
-
-	/**
-	 * The Growl protocol version used to send messages.
-	 */
-	const PROTOCOL_VERSION = 1;
-
-	/**
-	 * There are two types of messages sent to Growl: one to register applications, and one to send
-	 * notifications. This type registers the application with Growl's settings.
-	 */
-	const TYPE_REG = 0;
-
-	/**
-	 * This message type is for sending notifications to Growl.
-	 */
-	const TYPE_NOTIFY = 1;
-
-	/**
-	 * Holds the connection resource used to send messages to Growl.
-	 *
-	 * @var resource
-	 */
-	protected $_connection = null;
-
-	/**
-	 * Flag indicating whether the logger has successfully registered with the Growl server.
-	 * Registration only needs to happen once, but may fail for several reasons, including inability
-	 * to connect to the server, or the server requires a password which has not been specified.
-	 *
-	 * @var boolean
-	 */
-	protected $_registered = false;
-
-	/**
-	 * Allow the Growl connection resource to be auto-configured from constructor parameters.
-	 *
-	 * @var array
-	 */
-	protected $_autoConfig = array('connection', 'registered');
-
-	/**
-	 * Growl logger constructor. Accepts an array of settings which are merged with the default
-	 * settings and used to create the connection and handle notifications.
-	 *
-	 * @see lithium\analysis\Logger::write()
-	 * @param array $config The settings to configure the logger. Available settings are as follows:
-	 *              - `'name`' _string_: The name of the application as it should appear in Growl's
-	 *                system settings. Defaults to the directory name containing your application.
-	 *              - `'host'` _string_: The Growl host with which to communicate, usually your
-	 *                local machine. Use this setting to send notifications to another machine on
-	 *                the network. Defaults to `'127.0.0.1'`.
-	 *              - `'port'` _integer_: Port of the host machine. Defaults to the standard Growl
-	 *                port, `9887`.
-	 *              - `'password'` _string_: Only required if the host machine requires a password.
-	 *                If notification or registration fails, check this against the host machine's
-	 *                Growl settings.
-	 *              - '`protocol'` _string_: Protocol to use when opening socket communication to
-	 *                Growl. Defaults to `'udp'`.
-	 *              - `'title'` _string_: The default title to display when showing Growl messages.
-	 *                The default value is the same as `'name'`, but can be changed on a per-message
-	 *                basis by specifying a `'title'` key in the `$options` parameter of
-	 *                `Logger::write()`.
-	 *              - `'notification'` _array_: A list of message types you wish to register with
-	 *                Growl to be able to send. Defaults to `array('Errors', 'Messages')`.
-	 */
-	public function __construct(array $config = array()) {
-		$name = basename(LITHIUM_APP_PATH);
-
-		$defaults = compact('name') + array(
-			'host'     => '127.0.0.1',
-			'port'     => 9887,
-			'password' => null,
-			'protocol' => 'udp',
-			'title'    => Inflector::humanize($name),
-			'notifications' => array('Errors', 'Messages'),
-			'registered' => false
-		);
-		parent::__construct($config + $defaults);
-	}
-
-	/**
-	 * Writes `$message` to a new Growl notification.
-	 *
-	 * @param string $type The `Logger`-based priority of the message. This value is mapped to
-	 *               a Growl-specific priority value if possible.
-	 * @param string $message Message to be shown.
-	 * @param array $options Any options that are passed to the `notify()` method. See the
-	 *              `$options` parameter of `notify()`.
-	 * @return closure Function returning boolean `true` on successful write, `false` otherwise.
-	 */
-	public function write($type, $message, array $options = array()) {
-		$_self =& $this;
-		$_priorities = $this->_priorities;
-
-		return function($self, $params) use (&$_self, $_priorities) {
-			$priority = 0;
-			$options = $params['options'];
-
-			if (isset($options['priority']) && isset($_priorities[$options['priority']])) {
-				$priority = $_priorities[$options['priority']];
-			}
-			return $_self->notify($params['message'], compact('priority') + $options);
-		};
-	}
-
-	/**
-	 * Posts a new notification to the Growl server.
-	 *
-	 * @param string $description Message to be displayed.
-	 * @param array $options Options consists of:
-	 *        -'title': The title of the displayed notification. Displays the
-	 *         name of the application's parent folder by default.
-	 * @return boolean Always returns `true`.
-	 */
-	public function notify($description = '', $options = array()) {
-		$this->_register();
-
-		$defaults = array('sticky' => false, 'priority' => 0, 'type' => 'Messages');
-		$options += $defaults + array('title' => $this->_config['title']);
-		$type = $options['type'];
-		$title = $options['title'];
-
-		$message = compact('type', 'title', 'description') + array('app' => $this->_config['name']);
-		$message = array_map('utf8_encode', $message);
-
-		$flags = ($options['priority'] & 7) * 2;
-		$flags = ($options['priority'] < 0) ? $flags |= 8 : $flags;
-		$flags = ($options['sticky']) ? $flags | 256 : $flags;
-
-		$params = array('c2n5', static::PROTOCOL_VERSION, static::TYPE_NOTIFY, $flags);
-		$lengths = array_map('strlen', $message);
-
-		$data = call_user_func_array('pack', array_merge($params, $lengths));
-		$data .= join('', $message);
-		$data .= pack('H32', md5($data . $this->_config['password']));
-
-		$this->_send($data);
-		return true;
-	}
-
-	/**
-	 * Growl server connection registration and initialization.
-	 *
-	 * @return boolean True
-	 */
-	protected function _register() {
-		if ($this->_registered) {
-			return true;
-		}
-		$ct = count($this->_config['notifications']);
-		$app = utf8_encode($this->_config['name']);
-		$nameEnc = $defaultEnc = '';
-
-		foreach ($this->_config['notifications'] as $i => $name) {
-			$name = utf8_encode($name);
-			$nameEnc .= pack('n', strlen($name)) . $name;
-			$defaultEnc .= pack('c', $i);
-		}
-		$data = pack('c2nc2', static::PROTOCOL_VERSION, static::TYPE_REG, strlen($app), $ct, $ct);
-		$data .= $app . $nameEnc . $defaultEnc;
-		$checksum = pack('H32', md5($data . $this->_config['password']));
-		$data .= $checksum;
-
-		$this->_send($data);
-		return $this->_registered = true;
-	}
-
-	/**
-	 * Creates a connection to the Growl server using the protocol, host and port configurations
-	 * specified in the constructor.
-	 *
-	 * @return resource Returns a connection resource created by `fsockopen()`.
-	 */
-	protected function _connection() {
-		if ($this->_connection) {
-			return $this->_connection;
-		}
-		$host = "{$this->_config['protocol']}://{$this->_config['host']}";
-
-		if ($this->_connection = fsockopen($host, $this->_config['port'], $message, $code)) {
-			return $this->_connection;
-		}
-		throw new NetworkException("Growl connection failed: (`{$code}`) `{$message}`.");
-	}
-
-	/**
-	 * Sends binary data to the Growl server.
-	 *
-	 * @throws NetworkException Throws an exception if the server connection could not be written
-	 *         to.
-	 * @param string $data The raw binary data to send to the Growl server.
-	 * @return boolean Always returns `true`.
-	 */
-	protected function _send($data) {
-		if (fwrite($this->_connection(), $data, strlen($data)) === false) {
-			throw new NetworkException('Could not send registration to Growl Server.');
-		}
-		return true;
-	}
-
-	/**
-	 * Destructor method. Closes and releases the socket connection to Growl.
-	 */
-	public function __destruct() {
-		if (is_resource($this->_connection)) {
-			fclose($this->_connection);
-			unset($this->_connection);
-		}
-	}
-}
-
-?>

+ 0 - 86
frameworks/PHP/php-lithium/libraries/lithium/analysis/logger/adapter/Syslog.php

@@ -1,86 +0,0 @@
-<?php
-/**
- * Lithium: the most rad php framework
- *
- * @copyright     Copyright 2012, Union of RAD (http://union-of-rad.org)
- * @license       http://opensource.org/licenses/bsd-license.php The BSD License
- */
-
-namespace lithium\analysis\logger\adapter;
-
-/**
- * The Syslog adapter facilitates logging messages to a `syslogd` backend. See the constructor for
- * information on configuring this adapter.
- *
- * @see lithium\analysis\logger\adapter\Syslog::__construct()
- */
-class Syslog extends \lithium\core\Object {
-
-	/**
-	 * Flag indicating whether or not the connection to `syslogd` has been opened yet.
-	 *
-	 * @var boolean
-	 */
-	protected $_isConnected = false;
-
-	/**
-	 * Array that maps `Logger` message priority names to `syslog`-compatible priority constants.
-	 *
-	 * @var array
-	 */
-	protected $_priorities = array(
-		'emergency' => LOG_EMERG,
-		'alert'     => LOG_ALERT,
-		'critical'  => LOG_CRIT,
-		'error'     => LOG_ERR,
-		'warning'   => LOG_WARNING,
-		'notice'    => LOG_NOTICE,
-		'info'      => LOG_INFO,
-		'debug'     => LOG_DEBUG
-	);
-
-	/**
-	 * Class constructor. Configures the `Syslog` adapter instance with the default settings. For
-	 * more information on these settings, see the documentation for
-	 * [the `openlog()` function](http://php.net/openlog).
-	 *
-	 * @param array $config Available configuration settings for this adapter:
-	 *              - `'identity'` _string_: The identity string to be attached to each message in
-	 *                the system log. This is usually a string that meaningfully identifies your
-	 *                application. Defaults to `false`.
-	 *              - `'options'` _integer_: The flags to use when opening the log. Defaults to
-	 *                `LOG_ODELAY`.
-	 *              - `'facility'` _integer_: A flag specifying the program to use to log the
-	 *                messages. See the `openlog()` documentation for more information. Defaults to
-	 *                `LOG_USER`.
-	 */
-	public function __construct(array $config = array()) {
-		$defaults = array('identity' => false, 'options'  => LOG_ODELAY, 'facility' => LOG_USER);
-		parent::__construct($config + $defaults);
-	}
-
-	/**
-	 * Appends `$message` to the system log.
-	 *
-	 * @param string $priority The message priority string. Maps to a `syslogd` priority constant.
-	 * @param string $message The message to write.
-	 * @return closure Function returning boolean `true` on successful write, `false` otherwise.
-	 */
-	public function write($priority, $message) {
-		$config = $this->_config;
-		$_priorities = $this->_priorities;
-
-		if (!$this->_isConnected) {
-			closelog();
-			openlog($config['identity'], $config['options'], $config['facility']);
-			$this->_isConnected = true;
-		}
-
-		return function($self, $params) use ($_priorities) {
-			$priority = $_priorities[$params['priority']];
-			return syslog($priority, $params['message']);
-		};
-	}
-}
-
-?>

+ 0 - 22
frameworks/PHP/php-lithium/libraries/lithium/composer.json

@@ -1,22 +0,0 @@
-{
-	"name": "UnionOfRAD/lithium",
-	"type": "lithium-library",
-	"description": "The core library of the Lithium PHP framework",
-	"keywords": ["lithium", "framework"],
-	"homepage": "http://lithify.me",
-	"license": "BSD-3-Clause",
-	"authors": [
-		{
-			"name": "Union of RAD",
-			"homepage": "http://union-of-rad.org"
-		},
-		{
-			"name": "The Lithium Community",
-			"homepage": "http://github.com/UnionOfRAD/lithium/graphs/contributors"
-		}
-	],
-	"require": {
-		"php": ">=5.3.6",
-		"composer/installers": "dev-master"
-	}
-}

+ 0 - 423
frameworks/PHP/php-lithium/libraries/lithium/console/Command.php

@@ -1,423 +0,0 @@
-<?php
-/**
- * Lithium: the most rad php framework
- *
- * @copyright     Copyright 2013, Union of RAD (http://union-of-rad.org)
- * @license       http://opensource.org/licenses/bsd-license.php The BSD License
- */
-
-namespace lithium\console;
-
-use Exception;
-use lithium\console\command\Help;
-
-/**
- * All Commands to be run from the Lithium console must extend this class.
- *
- * The `run` method is automatically called if it exists. Otherwise, if a method does not exist
- * the `Help` command will be run.
- *
- * {{{
- * $ li3 example
- * $ li3 example --format=json
- * }}}
- *
- */
-class Command extends \lithium\core\Object {
-
-	/**
-	 * If -h or --help param exists a help screen will be returned.
-	 * Similar to running `li3 help COMMAND`.
-	 *
-	 * @var boolean
-	 */
-	public $help = false;
-
-	/**
-	 * A Request object.
-	 *
-	 * @see lithium\console\Request
-	 * @var object
-	 */
-	public $request;
-
-	/**
-	 * A Response object.
-	 *
-	 * @see lithium\console\Response
-	 * @var object
-	 */
-	public $response;
-
-	/**
-	 * Only shows only text output without styles.
-	 *
-	 * @var boolean
-	 */
-	public $plain = false;
-
-	/**
-	 * Only shows error output.
-	 *
-	 * @var boolean
-	 */
-	public $silent = false;
-
-	/**
-	 * Dynamic dependencies.
-	 *
-	 * @var array
-	 */
-	protected $_classes = array(
-		'response' => 'lithium\console\Response'
-	);
-
-	/**
-	 * Auto configuration.
-	 *
-	 * @var array
-	 */
-	protected $_autoConfig = array('classes' => 'merge');
-
-	/**
-	 * Constructor.
-	 *
-	 * @param array $config
-	 * @return void
-	 */
-	public function __construct(array $config = array()) {
-		$defaults = array('request' => null, 'response' => array(), 'classes' => $this->_classes);
-		parent::__construct($config + $defaults);
-	}
-
-	/**
-	 * Command Initializer.
-	 *
-	 * Populates the `$response` property with a new instance of the `Response` class passing it
-	 * configuration and assigns the values from named parameters of the request (if applicable) to
-	 * properties of the command.
-	 *
-	 * @return void
-	 */
-	protected function _init() {
-		parent::_init();
-		$this->request = $this->_config['request'];
-
-		if (!is_object($this->request) || !$this->request->params) {
-			return;
-		}
-		$this->response = $this->_config['response'];
-
-		if (!is_object($this->response)) {
-			$this->response = $this->_instance('response', $this->response);
-		}
-		$default = array('command' => null, 'action' => null, 'args' => null);
-		$params = array_diff_key((array) $this->request->params, $default);
-
-		foreach ($params as $key => $param) {
-			$this->{$key} = $param;
-		}
-	}
-
-	/**
-	 * Called by the `Dispatcher` class to invoke an action.
-	 *
-	 * @see lithium\console\Dispatcher
-	 * @see lithium\console\Response
-	 * @param string $action The name of the method to run.
-	 * @param array $args The arguments from the request.
-	 * @param array $options
-	 * @return object The response object associated with this command.
-	 * @todo Implement filters.
-	 */
-	public function __invoke($action, $args = array(), $options = array()) {
-		try {
-			$this->response->status = 1;
-			$result = $this->invokeMethod($action, $args);
-
-			if (is_int($result)) {
-				$this->response->status = $result;
-			} elseif ($result || $result === null) {
-				$this->response->status = 0;
-			}
-		} catch (Exception $e) {
-			$this->error($e->getMessage());
-		}
-		return $this->response;
-	}
-
-	/**
-	 * Invokes the `Help` command.
-	 *
-	 * The invoked Help command will take over request and response objects of
-	 * the originally invoked command. Thus the response of the Help command
-	 * becomes the response of the original one.
-	 *
-	 * @return boolean
-	 */
-	protected function _help() {
-		$help = new Help(array(
-			'request' => $this->request,
-			'response' => $this->response,
-			'classes' => $this->_classes
-		));
-		return $help->run(get_class($this));
-	}
-
-	/**
-	 * Writes a string to the output stream.
-	 *
-	 * @param string $output The string to write.
-	 * @param integer|string|array $options
-	 *        integer as the number of new lines.
-	 *        string as the style
-	 *        array as :
-	 *        - nl : number of new lines to add at the end
-	 *        - style : the style name to wrap around the
-	 * @return integer
-	 */
-	public function out($output = null, $options = array('nl' => 1)) {
-		if ($this->silent) {
-			return;
-		}
-		return $this->_response('output', $output, $options);
-	}
-
-	/**
-	 * Writes a string to error stream.
-	 *
-	 * @param string $error The string to write.
-	 * @param integer|string|array $options
-	 *        integer as the number of new lines.
-	 *        string as the style
-	 *        array as :
-	 *        - nl : number of new lines to add at the end
-	 *        - style : the style name to wrap around the
-	 * @return integer
-	 */
-	public function error($error = null, $options = array('nl' => 1)) {
-		return $this->_response('error', $error, $options);
-	}
-
-	/**
-	 * Handles input. Will continue to loop until `$options['quit']` or
-	 * result is part of `$options['choices']`.
-	 *
-	 * @param string $prompt
-	 * @param array $options
-	 * @return string Returns the result of the input data. If the input is equal to the `quit`
-	 *          option boolean `false` is returned
-	 */
-	public function in($prompt = null, array $options = array()) {
-		$defaults = array('choices' => null, 'default' => null, 'quit' => 'q');
-		$options += $defaults;
-		$choices = null;
-
-		if (is_array($options['choices'])) {
-			$choices = '(' . implode('/', $options['choices']) . ')';
-		}
-		$default = $options['default'] ? "[{$options['default']}] " : '';
-
-		do {
-			$this->out("{$prompt} {$choices} \n {$default}> ", false);
-			$result = trim($this->request->input());
-		} while (
-			!empty($options['choices']) && !in_array($result, $options['choices'], true)
-			&& (empty($options['quit']) || $result !== $options['quit'])
-			&& (!$options['default'] || $result !== '')
-		);
-
-		if ($result == $options['quit']) {
-			return false;
-		}
-
-		if ($options['default'] !== null && $result == '') {
-			return $options['default'];
-		}
-		return $result;
-	}
-
-	/**
-	 * Writes a header to the output stream. In addition to the actual text,
-	 * horizontal lines before and afterwards are written. The lines will have
-	 * the same length as the text. This behavior can be modified by providing
-	 * the length of lines as a second paramerter.
-	 *
-	 * Given the text `'Lithium'` this generates following output:
-	 *
-	 * {{{
-	 * -------
-	 * Lithium
-	 * -------
-	 * }}}
-	 *
-	 * @param string $text The heading text.
-	 * @param integer $line The length of the line. Defaults to the length of text.
-	 * @return void
-	 */
-	public function header($text, $line = null) {
-		if (!$line) {
-			$line = strlen($text);
-		}
-		$this->hr($line);
-		$this->out($text, 1, 'heading');
-		$this->hr($line);
-	}
-
-	/**
-	 * Writes rows of columns.
-	 *
-	 * This method expects asceding integer values as the keys, which map to the appropriate
-	 * columns. Currently, there is no special "header" option, but you can define them for your
-	 * own.
-	 *
-	 * Example Usage:
-	 *
-	 * {{{
-	 * $output = array(
-	 *     array('Name', 'Age'),
-	 *     array('----', '---'),
-	 * );
-	 * foreach($users as $user) {
-	 *     $output[] = array($user->name, $user->age);
-	 * }
-	 * $this->columns($output);
-	 * }}}
-	 *
-	 * Would render something similar to:
-	 *
-	 * {{{
-	 * Name       Age
-	 * ----       ---
-	 * Jane Doe   22
-	 * Foo Bar    18
-	 * }}}
-	 *
-	 * This method also calculates the needed space between the columns. All option params given
-	 * also get passed down to the `out()` method, which allow custom formatting. Passing something
-	 * like `$this->columns($output, array('style' => 'red)` would print the table in red.
-	 *
-	 * @see lithium\console\Response::styles()
-	 * @param array $rows The rows to print, with each column as an array element.
-	 * @param array $options Optional params:
-	 *      - separator : Different column separator, defaults to `\t`
-	 *      - style : the style name to wrap around the columns output
-	 * @return void
-	 */
-	public function columns($rows, $options = array()) {
-		$defaults = array('separator' => "\t", "error" => false);
-		$options += $defaults;
-		$lengths = array_reduce($rows, function($columns, $row) {
-			foreach ((array) $row as $key => $val) {
-				if (!isset($columns[$key]) || strlen($val) > $columns[$key]) {
-					$columns[$key] = strlen($val);
-				}
-			}
-			return $columns;
-		});
-		$rows = array_reduce($rows, function($rows, $row) use ($lengths, $options) {
-			$text = '';
-			foreach ((array) $row as $key => $val) {
-				$text = $text . str_pad($val, $lengths[$key]) . $options['separator'];
-			}
-			$rows[] = $text;
-			return $rows;
-		});
-		if ($options['error']) {
-			$this->error($rows, $options);
-			return;
-		}
-		$this->out($rows, $options);
-	}
-
-	/**
-	 * Add newlines ("\n") a given number of times and return them in a single string.
-	 *
-	 * @param integer $number The number of new lines to fill into a string.
-	 * @return string
-	 */
-	public function nl($number = 1) {
-		return str_repeat("\n", $number);
-	}
-
-	/**
-	 * Adds a horizontal line to output stream.
-	 *
-	 * @param integer $length The length of the line, defaults to 80.
-	 * @param integer $newlines How many new lines to print afterwards, defaults to 1.
-	 * @return integer
-	 */
-	public function hr($length = 80, $newlines = 1) {
-		return $this->out(str_repeat('-', $length), $newlines);
-	}
-
-	/**
-	 * Clears the entire screen.
-	 *
-	 * @return void
-	 */
-	public function clear() {
-		passthru(strtoupper(substr(PHP_OS, 0, 3)) == 'WIN' ? 'cls' : 'clear');
-	}
-
-	/**
-	 * Stop execution, by exiting the script.
-	 *
-	 * @param integer $status Numeric value that will be used on `exit()`.
-	 * @param boolean $message An optional message that will be written to the stream.
-	 * @return void
-	 */
-	public function stop($status = 0, $message = null) {
-		if ($message) {
-			($status == 0) ? $this->out($message) : $this->error($message);
-		}
-		exit($status);
-	}
-
-	/**
-	 * Handles the response that is sent to the stream.
-	 *
-	 * @param string $type the stream either output or error
-	 * @param string $string the message to render
-	 * @param integer|string|array $options
-	 *        integer as the number of new lines.
-	 *        string as the style
-	 *        array as :
-	 *        - nl : number of new lines to add at the end
-	 *        - style : the style name to wrap around the
-	 * @return void
-	 */
-	protected function _response($type, $string, $options) {
-		$defaults = array('nl' => 1, 'style' => null);
-
-		if (!is_array($options)) {
-			if (!$options || is_int($options)) {
-				$options = array('nl' => $options);
-			} else if (is_string($options)) {
-				$options = array('style' => $options);
-			} else {
-				$options = array();
-			}
-		}
-		$options += $defaults;
-
-		if (is_array($string)) {
-			$method = ($type == 'error' ? $type : 'out');
-			foreach ($string as $out) {
-				$this->{$method}($out, $options);
-			}
-			return;
-		}
-		extract($options);
-
-		if ($style !== null && !$this->plain) {
-			$string = "{:{$style}}{$string}{:end}";
-		}
-		if ($nl) {
-			$string = $string . $this->nl($nl);
-		}
-		return $this->response->{$type}($string);
-	}
-}
-
-?>

+ 0 - 202
frameworks/PHP/php-lithium/libraries/lithium/console/Dispatcher.php

@@ -1,202 +0,0 @@
-<?php
-/**
- * Lithium: the most rad php framework
- *
- * @copyright     Copyright 2013, Union of RAD (http://union-of-rad.org)
- * @license       http://opensource.org/licenses/bsd-license.php The BSD License
- */
-
-namespace lithium\console;
-
-use lithium\core\Libraries;
-use lithium\core\Environment;
-use UnexpectedValueException;
-
-/**
- * The `Dispatcher` is the outermost layer of the framework, responsible for both receiving the
- * initial console request and returning back a response at the end of the request's life cycle.
- *
- * The console dispatcher is responsible for accepting requests from scripts called from the command
- * line, and executing the appropriate `Command` class(es). The `run()` method accepts an instance
- * of `lithium\console\Request`, which encapsulates the console environment and any command-line
- * parameters passed to the script. `Dispatcher` then invokes `lithium\console\Router` to determine
- * the correct `Command` class to invoke, and which method should be called.
- */
-class Dispatcher extends \lithium\core\StaticObject {
-
-	/**
-	 * Fully-namespaced router class reference.
-	 *
-	 * Class must implement a `parse()` method, which must return an array with (at a minimum)
-	 * 'command' and 'action' keys.
-	 *
-	 * @see lithium\console\Router::parse()
-	 * @var array
-	 */
-	protected static $_classes = array(
-		'request' => 'lithium\console\Request',
-		'router' => 'lithium\console\Router'
-	);
-
-	/**
-	 * Contains pre-process format strings for changing Dispatcher's behavior based on 'rules'.
-	 *
-	 * Each key in the array represents a 'rule'; if a key that matches the rule is present (and
-	 * not empty) in a route, (i.e. the result of `lithium\console\Router::parse()`) then the rule's
-	 * value will be applied to the route before it is dispatched.  When applying a rule, any array
-	 * elements array elements of the flag which are present in the route will be modified using a
-	 * `lithium\util\String::insert()`-formatted string.
-	 *
-	 * @see lithium\console\Dispatcher::config()
-	 * @see lithium\util\String::insert()
-	 * @var array
-	 */
-	protected static $_rules = array(
-		'command' => array(array('lithium\util\Inflector', 'camelize')),
-		'action' => array(array('lithium\util\Inflector', 'camelize', array(false)))
-	);
-
-	/**
-	 * Used to set configuration parameters for the Dispatcher.
-	 *
-	 * @param array $config Optional configuration params.
-	 * @return array If no parameters are passed, returns an associative array with the
-	 *         current configuration, otherwise returns null.
-	 */
-	public static function config($config = array()) {
-		if (!$config) {
-			return array('rules' => static::$_rules);
-		}
-		foreach ($config as $key => $val) {
-			if (isset(static::${'_' . $key})) {
-				static::${'_' . $key} = $val + static::${'_' . $key};
-			}
-		}
-	}
-
-	/**
-	 * Dispatches a request based on a request object (an instance of `lithium\console\Request`).
-	 *
-	 *  If `$request` is `null`, a new request object is instantiated based on the value of the
-	 * `'request'` key in the `$_classes` array.
-	 *
-	 * @param object $request An instance of a request object with console request information.  If
-	 *        `null`, an instance will be created.
-	 * @param array $options
-	 * @return object The command action result which is an instance of `lithium\console\Response`.
-	 */
-	public static function run($request = null, $options = array()) {
-		$defaults = array('request' => array());
-		$options += $defaults;
-		$classes = static::$_classes;
-		$params = compact('request', 'options');
-
-		return static::_filter(__FUNCTION__, $params, function($self, $params) use ($classes) {
-			$request = $params['request'];
-			$options = $params['options'];
-			$router = $classes['router'];
-			$request = $request ?: new $classes['request']($options['request']);
-			$request->params = $router::parse($request);
-			$params = $self::applyRules($request->params);
-			Environment::set($request);
-			try {
-				$callable = $self::invokeMethod('_callable', array($request, $params, $options));
-				return $self::invokeMethod('_call', array($callable, $request, $params));
-			} catch (UnexpectedValueException $e) {
-				return (object) array('status' => $e->getMessage() . "\n");
-			}
-		});
-	}
-
-	/**
-	 * Determines which command to use for current request.
-	 *
-	 * @param object $request An instance of a `Request` object.
-	 * @param array $params Request params that can be accessed inside the filter.
-	 * @param array $options
-	 * @return class lithium\console\Command Returns the instantiated command object.
-	 */
-	protected static function _callable($request, $params, $options) {
-		$params = compact('request', 'params', 'options');
-		return static::_filter(__FUNCTION__, $params, function($self, $params) {
-			$request = $params['request'];
-			$params = $params['params'];
-			$name = $params['command'];
-
-			if (!$name) {
-				$request->params['args'][0] = $name;
-				$name = 'lithium\console\command\Help';
-			}
-			if (class_exists($class = Libraries::locate('command', $name))) {
-				return new $class(compact('request'));
-			}
-			throw new UnexpectedValueException("Command `{$name}` not found.");
-		});
-	}
-
-	/**
-	 * Attempts to apply a set of formatting rules from `$_rules` to a `$params` array.
-	 *
-	 * Each formatting rule is applied if the key of the rule in `$_rules` is present and not empty
-	 * in `$params`.  Also performs sanity checking against `$params` to ensure that no value
-	 * matching a rule is present unless the rule check passes.
-	 *
-	 * @param array $params An array of route parameters to which rules will be applied.
-	 * @return array Returns the `$params` array with formatting rules applied to array values.
-	 */
-	public static function applyRules($params) {
-		$result = array();
-
-		if (!$params) {
-			return false;
-		}
-
-		foreach (static::$_rules as $name => $rules) {
-			foreach ($rules as $rule) {
-				if (!empty($params[$name]) && isset($rule[0])) {
-					$options = array_merge(
-						array($params[$name]), isset($rule[2]) ? (array) $rule[2] : array()
-					);
-					$result[$name] = call_user_func_array(array($rule[0], $rule[1]), $options);
-				}
-			}
-		}
-		return $result + array_diff_key($params, $result);
-	}
-
-	/**
-	 * Calls a given command with the appropriate action.
-	 *
-	 * This method is responsible for calling a `$callable` command and returning its result.
-	 *
-	 * @param string $callable The callable command.
-	 * @param string $request The associated `Request` object.
-	 * @param string $params Additional params that should be passed along.
-	 * @return mixed Returns the result of the called action, typically `true` or `false`.
-	 */
-	protected static function _call($callable, $request, $params) {
-		$params = compact('callable', 'request', 'params');
-		return static::_filter(__FUNCTION__, $params, function($self, $params) {
-			if (is_callable($callable = $params['callable'])) {
-				$request = $params['request'];
-				$params = $params['params'];
-
-				if (!method_exists($callable, $params['action'])) {
-					array_unshift($params['args'], $request->params['action']);
-					$params['action'] = 'run';
-				}
-				$isHelp = (
-					!empty($params['help']) || !empty($params['h'])
-					|| !method_exists($callable, $params['action'])
-				);
-				if ($isHelp) {
-					$params['action'] = '_help';
-				}
-				return $callable($params['action'], $params['args']);
-			}
-			throw new UnexpectedValueException("Callable `{$callable}` is actually not callable.");
-		});
-	}
-}
-
-?>

+ 0 - 203
frameworks/PHP/php-lithium/libraries/lithium/console/Request.php

@@ -1,203 +0,0 @@
-<?php
-/**
- * Lithium: the most rad php framework
- *
- * @copyright     Copyright 2013, Union of RAD (http://union-of-rad.org)
- * @license       http://opensource.org/licenses/bsd-license.php The BSD License
- */
-
-namespace lithium\console;
-
-/**
- * The `Request` class represents a console request and holds information about it's
- * environment as well as passed arguments.
- *
- * @see lithium\console\Dispatcher
- */
-class Request extends \lithium\core\Object {
-
-	/**
-	 * The raw data passed from the command line
-	 *
-	 * @var array
-	 */
-	public $argv = array();
-
-	/**
-	 * Parameters parsed from arguments.
-	 *
-	 * @see lithium\console\Router
-	 * @var array
-	 */
-	public $params = array(
-		'command' => null, 'action' => 'run', 'args' => array()
-	);
-
-	/**
-	 * Input (STDIN).
-	 *
-	 * @var resource
-	 */
-	public $input;
-
-	/**
-	 * Enviroment variables.
-	 *
-	 * @var array
-	 */
-	protected $_env = array();
-
-	/**
-	 * Holds the value of the current locale, set through the `locale()` method.
-	 *
-	 * @var string
-	 */
-	protected $_locale = null;
-
-	/**
-	 * Auto configuration
-	 *
-	 * @var array
-	 */
-	protected $_autoConfig = array('env' => 'merge');
-
-	/**
-	 * Class Constructor
-	 *
-	 * @param array $config
-	 */
-	public function __construct($config = array()) {
-		$defaults = array('args' => array(), 'input' => null);
-		$config += $defaults;
-		parent::__construct($config);
-	}
-
-	/**
-	 * Initialize request object, pulling request data from superglobals.
-	 *
-	 * Defines an artificial `'PLATFORM'` environment variable as `'CLI'` to
-	 * allow checking for the SAPI in a normalized way. This is also for
-	 * establishing consistency with this class' sister classes.
-	 *
-	 * @see lithium\action\Request::_init()
-	 * @return void
-	 */
-	protected function _init() {
-		$this->_env += (array) $_SERVER + (array) $_ENV;
-		$this->_env['working'] = getcwd() ?: null;
-		$argv = (array) $this->env('argv');
-		$this->_env['script'] = array_shift($argv);
-		$this->_env['PLATFORM'] = 'CLI';
-		$this->argv += $argv + (array) $this->_config['args'];
-		$this->input = $this->_config['input'];
-
-		if (!is_resource($this->_config['input'])) {
-			$this->input = fopen('php://stdin', 'r');
-		}
-		parent::_init();
-	}
-
-	/**
-	 * Allows request parameters to be accessed as object properties, i.e. `$this->request->action`
-	 * instead of `$this->request->params['action']`.
-	 *
-	 * @see lithium\action\Request::$params
-	 * @param string $name The property name/parameter key to return.
-	 * @return mixed Returns the value of `$params[$name]` if it is set, otherwise returns null.
-	 */
-	public function __get($name) {
-		if (isset($this->params[$name])) {
-			return $this->params[$name];
-		}
-	}
-
-	public function __isset($name) {
-		return isset($this->params[$name]);
-	}
-
-	/**
-	 * Get the value of a command line argument at a given key
-	 *
-	 * @param integer $key
-	 * @return mixed returns null if key does not exist or the value of the key in the args array
-	 */
-	public function args($key = 0) {
-		if (!empty($this->args[$key])) {
-			return $this->args[$key];
-		}
-		return null;
-	}
-
-	/**
-	 * Get environment variables.
-	 *
-	 * @param string $key
-	 * @return mixed Returns the environment key related to the `$key` argument. If `$key` is equal
-	 * to null the result will be the entire environment array. If `$key` is set but not
-	 * available, `null` will be returned.
-	 */
-	public function env($key = null) {
-		if (!empty($this->_env[$key])) {
-			return $this->_env[$key];
-		}
-		if ($key === null) {
-			return $this->_env;
-		}
-		return null;
-	}
-
-	/**
-	 * Moves params up a level. Sets command to action, action to passed[0], and so on.
-	 *
-	 * @param integer $num how many times to shift
-	 * @return self
-	 */
-	public function shift($num = 1) {
-		for ($i = $num; $i > 1; $i--) {
-			$this->shift(--$i);
-		}
-		$this->params['command'] = $this->params['action'];
-		if (isset($this->params['args'][0])) {
-			$this->params['action'] = array_shift($this->params['args']);
-		}
-		return $this;
-	}
-
-	/**
-	 * Reads a line from input.
-	 *
-	 * @return string
-	 */
-	public function input() {
-		return fgets($this->input);
-	}
-
-	/**
-	 * Sets or returns the current locale string. For more information, see
-	 * "[Globalization](http://lithify.me/docs/manual/07_globalization)" in the manual.
-	 *
-	 * @param string $locale An optional locale string like `'en'`, `'en_US'` or `'de_DE'`. If
-	 *               specified, will overwrite the existing locale.
-	 * @return Returns the currently set locale string.
-	 */
-	public function locale($locale = null) {
-		if ($locale) {
-			$this->_locale = $locale;
-		}
-		return $this->_locale;
-	}
-
-	/**
-	 * Return input
-	 * Destructor. Closes input.
-	 *
-	 * @return void
-	 */
-	public function __destruct() {
-		if ($this->input) {
-			fclose($this->input);
-		}
-	}
-}
-
-?>

+ 0 - 142
frameworks/PHP/php-lithium/libraries/lithium/console/Response.php

@@ -1,142 +0,0 @@
-<?php
-/**
- * Lithium: the most rad php framework
- *
- * @copyright     Copyright 2012, Union of RAD (http://union-of-rad.org)
- * @license       http://opensource.org/licenses/bsd-license.php The BSD License
- */
-
-namespace lithium\console;
-
-use lithium\util\String;
-
-/**
- * The `Response` class is used by other console classes to generate output. It contains stream
- * resources for writing output and errors, as well as shell coloring information, and the response
- * status code for the currently-executing command.
- */
-class Response extends \lithium\core\Object {
-
-	/**
-	 * Output stream, STDOUT
-	 *
-	 * @var stream
-	 */
-	public $output = null;
-
-	/**
-	 * Error stream, STDERR
-	 *
-	 * @var stream
-	 */
-	public $error = null;
-
-	/**
-	 * Status code, most often used for setting an exit status.
-	 *
-	 * It should be expected that only status codes in the range of 0-255
-	 * can be properly evaluated.
-	 *
-	 * @var integer
-	 * @see lithium\console\Command
-	 */
-	public $status = 0;
-
-	/**
-	 * Construct Request object
-	 *
-	 * @param array $config
-	 *              - request object lithium\console\Request
-	 *              - output stream
-	 *              _ error stream
-	 */
-	public function __construct($config = array()) {
-		$defaults = array('output' => null, 'error' => null);
-		$config += $defaults;
-
-		$this->output = $config['output'];
-
-		if (!is_resource($this->output)) {
-			$this->output = fopen('php://stdout', 'r');
-		}
-
-		$this->error = $config['error'];
-
-		if (!is_resource($this->error)) {
-			$this->error = fopen('php://stderr', 'r');
-		}
-		parent::__construct($config);
-	}
-
-	/**
-	 * Writes string to output stream
-	 *
-	 * @param string $output
-	 * @return mixed
-	 */
-	public function output($output) {
-		return fwrite($this->output, String::insert($output, $this->styles()));
-	}
-
-	/**
-	 * Writes string to error stream
-	 *
-	 * @param string $error
-	 * @return mixed
-	 */
-	public function error($error) {
-		return fwrite($this->error, String::insert($error, $this->styles()));
-	}
-
-	/**
-	 * Destructor to close streams
-	 *
-	 * @return void
-	 *
-	 */
-	public function __destruct() {
-		if ($this->output) {
-			fclose($this->output);
-		}
-		if ($this->error) {
-			fclose($this->error);
-		}
-	}
-
-	/**
-	 * Handles styling output.
-	 *
-	 * @param array $styles
-	 * @return array
-	 */
-	public function styles($styles = array()) {
-		$defaults = array(
-			'end'    => "\033[0m",
-			'black'  => "\033[0;30m",
-			'red'    => "\033[0;31m",
-			'green'  => "\033[0;32m",
-			'yellow' => "\033[0;33m",
-			'blue'   => "\033[0;34m",
-			'purple' => "\033[0;35m",
-			'cyan'   => "\033[0;36m",
-			'white'  => "\033[0;37m",
-			'heading' => "\033[1;36m",
-			'option'  => "\033[0;35m",
-			'command' => "\033[0;35m",
-			'error'   => "\033[0;31m",
-			'success' => "\033[0;32m",
-			'bold'    => "\033[1m",
-		);
-		if ($styles === false) {
-			return array_combine(array_keys($defaults), array_pad(array(), count($defaults), null));
-		}
-		$styles += $defaults;
-
-		if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
-			return $this->styles(false);
-		}
-		return $styles;
-	}
-}
-
-?>

+ 0 - 55
frameworks/PHP/php-lithium/libraries/lithium/console/Router.php

@@ -1,55 +0,0 @@
-<?php
-/**
- * Lithium: the most rad php framework
- *
- * @copyright     Copyright 2013, Union of RAD (http://union-of-rad.org)
- * @license       http://opensource.org/licenses/bsd-license.php The BSD License
- */
-
-namespace lithium\console;
-
-/**
- * The `Router` class uses an instance of `lithium\console\Request`, which represents an incoming
- * command-line invocation, to parse the correct command, and sub-command(s) and parameters, which
- * are used by `lithium\console\Dispatcher` to load and execute the proper `Command` class.
- */
-class Router extends \lithium\core\Object {
-
-	/**
-	 * Parse incoming request from console. Short and long (GNU-style) options
-	 * in the form of `-f`, `--foo`, `--foo-bar` and `--foo=bar` are parsed.
-	 * XF68-style long options (i.e. `-foo`) are not supported but support
-	 * can be added by extending this class.
-	 *
-	 * @param object $request lithium\console\Request
-	 * @return array $params
-	 */
-	public static function parse($request = null) {
-		$defaults = array('command' => null, 'action' => 'run', 'args' => array());
-		$params = $request ? (array) $request->params + $defaults : $defaults;
-
-		if (!empty($request->argv)) {
-			$args = $request->argv;
-
-			while ($arg = array_shift($args)) {
-				if (preg_match('/^-(?P<key>[a-zA-Z0-9])$/i', $arg, $match)) {
-					$params[$match['key']] = true;
-					continue;
-				}
-				if (preg_match('/^--(?P<key>[a-z0-9-]+)(?:=(?P<val>.+))?$/i', $arg, $match)) {
-					$params[$match['key']] = !isset($match['val']) ? true : $match['val'];
-					continue;
-				}
-				$params['args'][] = $arg;
-			}
-		}
-		foreach (array('command', 'action') as $param) {
-			if (!empty($params['args'])) {
-				$params[$param] = array_shift($params['args']);
-			}
-		}
-		return $params;
-	}
-}
-
-?>

+ 0 - 260
frameworks/PHP/php-lithium/libraries/lithium/console/command/Create.php

@@ -1,260 +0,0 @@
-<?php
-/**
- * Lithium: the most rad php framework
- *
- * @copyright     Copyright 2012, Union of RAD (http://union-of-rad.org)
- * @license       http://opensource.org/licenses/bsd-license.php The BSD License
- */
-
-namespace lithium\console\command;
-
-use lithium\util\String;
-use lithium\core\Libraries;
-use lithium\util\Inflector;
-use lithium\core\ClassNotFoundException;
-
-/**
- * The `create` command allows you to rapidly develop your models, views, controllers, and tests
- * by generating the minimum code necessary to test and run your application.
- *
- * `li3 create --template=controller Posts`
- * `li3 create --template=model Posts`
- *
- */
-class Create extends \lithium\console\Command {
-
-	/**
-	 * Name of library to use
-	 *
-	 * @var string
-	 */
-	public $library = null;
-
-	/**
-	 * The name of the template to use to generate the file. This allows you to add a custom
-	 * template to be used in place of the core template for each command. Place templates in
-	 * `<library>\extensions\command\create\template`.
-	 *
-	 * @var string
-	 */
-	public $template = null;
-
-	/**
-	 * Holds library data from `lithium\core\Libraries::get()`.
-	 *
-	 * @var array
-	 */
-	protected $_library = array();
-
-	/**
-	 * Class initializer. Parses template and sets up params that need to be filled.
-	 *
-	 * @return void
-	 */
-	protected function _init() {
-		parent::_init();
-		$this->library = $this->library ?: true;
-		$defaults = array('prefix' => null, 'path' => null);
-		$this->_library = (array) Libraries::get($this->library) + $defaults;
-	}
-
-	/**
-	 * Run the create command. Takes `$command` and delegates to `$command::$method`
-	 *
-	 * @param string $command
-	 * @return boolean
-	 */
-	public function run($command = null) {
-		if ($command && !$this->request->args()) {
-			return $this->_default($command);
-		}
-		$this->request->shift();
-		$this->template = $this->template ?: $command;
-
-		if (!$command) {
-			return false;
-		}
-		if ($this->_execute($command)) {
-			return true;
-		}
-		$this->error("{$command} could not be created.");
-		return false;
-	}
-
-	/**
-	 * Execute the given sub-command for the current request.
-	 *
-	 * @param string $command The sub-command name. example: Model, Controller, Test
-	 * @return boolean
-	 */
-	protected function _execute($command) {
-		try {
-			if (!$class = $this->_instance($command)) {
-				return false;
-			}
-		} catch (ClassNotFoundException $e) {
-			return false;
-		}
-		$data = array();
-		$params = $class->invokeMethod('_params');
-
-		foreach ($params as $i => $param) {
-			$data[$param] = $class->invokeMethod("_{$param}", array($this->request));
-		}
-
-		if ($message = $class->invokeMethod('_save', array($data))) {
-			$this->out($message);
-			return true;
-		}
-		return false;
-	}
-
-	/**
-	 * Run through the default set. model, controller, test model, test controller
-	 *
-	 * @param string $name class name to create
-	 * @return boolean
-	 */
-	protected function _default($name) {
-		$commands = array(
-			array('model', Inflector::pluralize($name)),
-			array('controller', Inflector::pluralize($name)),
-			array('test', 'model', Inflector::pluralize($name)),
-			array('test', 'controller', Inflector::pluralize($name))
-		);
-		foreach ($commands as $args) {
-			$command = $this->template = $this->request->params['command'] = array_shift($args);
-			$this->request->params['action'] = array_shift($args);
-			$this->request->params['args'] = $args;
-
-			if (!$this->_execute($command)) {
-				return false;
-			}
-		}
-		return true;
-	}
-
-	/**
-	 * Get the namespace.
-	 *
-	 * @param string $request
-	 * @param array $options
-	 * @return string
-	 */
-	protected function _namespace($request, $options  = array()) {
-		$name = $request->command;
-		$defaults = array(
-			'prefix' => $this->_library['prefix'],
-			'prepend' => null,
-			'spaces' => array(
-				'model' => 'models', 'view' => 'views', 'controller' => 'controllers',
-				'command' => 'extensions.command', 'adapter' => 'extensions.adapter',
-				'helper' => 'extensions.helper'
-			)
-		);
-		$options += $defaults;
-
-		if (isset($options['spaces'][$name])) {
-			$name = $options['spaces'][$name];
-		}
-		return str_replace('.', '\\', $options['prefix'] . $options['prepend'] . $name);
-	}
-
-	/**
-	 * Parse a template to find available variables specified in `{:name}` format. Each variable
-	 * corresponds to a method in the sub command. For example, a `{:namespace}` variable will
-	 * call the namespace method in the model command when `li3 create model Post` is called.
-	 *
-	 * @return array
-	 */
-	protected function _params() {
-		$contents = $this->_template();
-
-		if (empty($contents)) {
-			return array();
-		}
-		preg_match_all('/(?:\{:(?P<params>[^}]+)\})/', $contents, $keys);
-
-		if (!empty($keys['params'])) {
-			return array_values(array_unique($keys['params']));
-		}
-		return array();
-	}
-
-	/**
-	 * Returns the contents of the template.
-	 *
-	 * @return string
-	 */
-	protected function _template() {
-		$file = Libraries::locate('command.create.template', $this->template, array(
-			'filter' => false, 'type' => 'file', 'suffix' => '.txt.php'
-		));
-		if (!$file || is_array($file)) {
-			return false;
-		}
-		return file_get_contents($file);
-	}
-
-	/**
-	 * Get an instance of a sub-command
-	 *
-	 * @param string $name the name of the sub-command to instantiate
-	 * @param array $config
-	 * @return object;
-	 */
-	protected function _instance($name, array $config = array()) {
-		if ($class = Libraries::locate('command.create', Inflector::camelize($name))) {
-			$this->request->params['template'] = $this->template;
-
-			return new $class(array(
-				'request' => $this->request,
-				'classes' => $this->_classes
-			));
-		}
-		return parent::_instance($name, $config);
-	}
-
-
-	/**
-	 * Save a template with the current params. Writes file to `Create::$path`.
-	 *
-	 * @param array $params
-	 * @return string A result string on success of writing the file. If any errors occur along
-	 * the way such as missing information boolean false is returned.
-	 */
-	protected function _save(array $params = array()) {
-		$defaults = array('namespace' => null, 'class' => null);
-		$params += $defaults;
-
-		if (empty($params['class']) || empty($this->_library['path'])) {
-			return false;
-		}
-		$contents = $this->_template();
-		$result = String::insert($contents, $params);
-		$namespace = str_replace($this->_library['prefix'], '\\', $params['namespace']);
-		$path = str_replace('\\', '/', "{$namespace}\\{$params['class']}");
-		$path = $this->_library['path'] . stristr($path, '/');
-		$file = str_replace('//', '/', "{$path}.php");
-		$directory = dirname($file);
-		$relative = str_replace($this->_library['path'] . '/', "", $file);
-
-		if ((!is_dir($directory)) && !mkdir($directory, 0755, true)) {
-			return false;
-		}
-		if (file_exists($file)) {
-			$prompt = "{$relative} already exists. Overwrite?";
-			$choices = array('y', 'n');
-			if ($this->in($prompt, compact('choices')) !== 'y') {
-				return "{$params['class']} skipped.";
-			}
-		}
-
-		if (file_put_contents($file, "<?php\n\n{$result}\n\n?>")) {
-			return "{$params['class']} created in {$relative}.";
-		}
-		return false;
-	}
-}
-
-?>

+ 0 - 36
frameworks/PHP/php-lithium/libraries/lithium/console/command/G11n.php

@@ -1,36 +0,0 @@
-<?php
-/**
- * Lithium: the most rad php framework
- *
- * @copyright     Copyright 2013, Union of RAD (http://union-of-rad.org)
- * @license       http://opensource.org/licenses/bsd-license.php The BSD License
- */
-
-namespace lithium\console\command;
-
-use lithium\console\command\g11n\Extract;
-
-/**
- * The `G11n` set of commands deals with the extraction and merging of message templates.
- */
-class G11n extends \lithium\console\Command {
-
-	/**
-	 * The main method of the command.
-	 *
-	 * @return void
-	 */
-	public function run() {}
-
-	/**
-	 * Runs the `Extract` command.
-	 *
-	 * @return void
-	 */
-	public function extract() {
-		$extract = new Extract(array('request' => $this->request));
-		return $extract->run();
-	}
-}
-
-?>

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác